- If you are concerned about the "view" part of metrics/healthchecks, you can set filter that will apply when data is returned. It can be done on start of an application:
environment.getAdminContext().setAttribute(MetricsServlet.METRIC_FILTER, new MetricFilter() {
@Override
public boolean matches(final String name, final Metric metric) {
return // you logic;
}
});
environment.getAdminContext().setAttribute(HealthCheckServlet.HEALTH_CHECK_FILTER, new HealthCheckFilter() {
@Override
public boolean matches(final String s, final HealthCheck healthCheck) {
return // you logic;
}
});
- If you don't want to have metrics/healthchecks at all, you can directly remove them:
environment.healthChecks().unregister();
environment.metrics().remove();