Package org.apache.sling.commons.metrics
Interface MetricsService
-
@ProviderType public interface MetricsService
TheMetricsService
enables creation of various types ofMetric
.
-
-
Field Summary
Fields Modifier and Type Field Description static MetricsService
NOOP
Dummy variant of MetricsService which does not collect any metric
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <A> A
adaptTo(Class<A> type)
Adapts the service to the specified type.Counter
counter(String name)
Creates a newCounter
and registers it under the given name.Histogram
histogram(String name)
Creates a newHistogram
and registers it under the given name.Meter
meter(String name)
Creates a newMeter
and registers it under the given name.Timer
timer(String name)
Creates a newTimer
and registers it under the given name.
-
-
-
Field Detail
-
NOOP
static final MetricsService NOOP
Dummy variant of MetricsService which does not collect any metric
-
-
Method Detail
-
timer
Timer timer(String name)
Creates a newTimer
and registers it under the given name. If a timer with same name exists then same instance is returned- Parameters:
name
- the name of the metric- Returns:
- a new
Timer
-
histogram
Histogram histogram(String name)
Creates a newHistogram
and registers it under the given name. If a histogram with same name exists then same instance is returned.- Parameters:
name
- the name of the metric- Returns:
- a new
Histogram
-
counter
Counter counter(String name)
Creates a newCounter
and registers it under the given name. If a counter with same name exists then same instance is returned- Parameters:
name
- the name of the metric- Returns:
- a new
Counter
-
meter
Meter meter(String name)
Creates a newMeter
and registers it under the given name. If a meter with same name exists then same instance is returned- Parameters:
name
- the name of the metric- Returns:
- a new
Meter
-
adaptTo
<A> A adaptTo(Class<A> type)
Adapts the service to the specified type. This can be used to get instance to underlyingMetricRegistry
- Type Parameters:
A
- The type to which this metric is to be adapted.- Parameters:
type
- Class object for the type to which this metric is to be adapted.- Returns:
- The object, of the specified type, to which this metric has been adapted or null if this metric cannot be adapted to the specified type.
-
-