Package com.nimbusds.common.monitor
Class MonitorRegistries
- java.lang.Object
-
- com.nimbusds.common.monitor.MonitorRegistries
-
public class MonitorRegistries extends Object
Shared monitor registers for Dropwizard metrics and health checks.- See Also:
MonitorLauncher
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
getEntryCountCacheTimeout()
Gets the timeout for entry count gauges.static com.codahale.metrics.health.HealthCheckRegistry
getHealthCheckRegistry()
Returns the singleton shared registry for health check instances.static com.codahale.metrics.MetricRegistry
getMetricRegistry()
Returns the singleton shared registry for metric instances.static void
register(com.codahale.metrics.MetricSet metricSet)
Registers a metric set.static void
register(String name, com.codahale.metrics.health.HealthCheck check)
Registers, updates or unregisters a health check.static void
register(String name, com.codahale.metrics.Metric metric)
Registers, updates or unregisters a metric.static void
registerEntryCountGauge(String name, Supplier<Integer> supplier)
Registers or updates an entry count gauge according to the configuredcache timeout
.static void
setEntryCountCacheTimeout(long entryCountCacheTimeout)
Sets the timeout for entry count gauges.
-
-
-
Method Detail
-
getMetricRegistry
public static com.codahale.metrics.MetricRegistry getMetricRegistry()
Returns the singleton shared registry for metric instances.- Returns:
- The registry.
-
getHealthCheckRegistry
public static com.codahale.metrics.health.HealthCheckRegistry getHealthCheckRegistry()
Returns the singleton shared registry for health check instances.- Returns:
- The registry.
-
register
public static void register(com.codahale.metrics.MetricSet metricSet)
Registers a metric set.- Parameters:
metricSet
- The metric set to register. Ifnull
the method will return immediately.
-
register
public static void register(String name, com.codahale.metrics.Metric metric)
Registers, updates or unregisters a metric.- Parameters:
name
- The metric name. Ifnull
the method will return immediately.metric
- The metric,null
to unregister. If a metric with the same name exists it will be replaced.
-
registerEntryCountGauge
public static void registerEntryCountGauge(String name, Supplier<Integer> supplier)
Registers or updates an entry count gauge according to the configuredcache timeout
.- Parameters:
name
- The gauge name name. Ifnull
the method will return immediately.supplier
- The entry count supplier.
-
getEntryCountCacheTimeout
public static long getEntryCountCacheTimeout()
Gets the timeout for entry count gauges.- Returns:
- The timeout for caching entry count results, in seconds. Zero means no caching, negative disabled readings.
-
setEntryCountCacheTimeout
public static void setEntryCountCacheTimeout(long entryCountCacheTimeout)
Sets the timeout for entry count gauges.- Parameters:
entryCountCacheTimeout
- The timeout for caching entry count results, in seconds. Zero means no caching, negative disabled readings.
-
register
public static void register(String name, com.codahale.metrics.health.HealthCheck check)
Registers, updates or unregisters a health check.- Parameters:
name
- The health check name. Ifnull
the method will return immediately.check
- The health check,null
to unregister. If a metric with the same name exists it will be replaced.
-
-