public class MetricsRegistryImpl extends Object implements MetricsRegistry
MetricsRegistry implementation.| Constructor and Description |
|---|
MetricsRegistryImpl(ILogger logger,
ProbeLevel minimumLevel)
Creates a MetricsRegistryImpl instance.
|
MetricsRegistryImpl(String name,
ILogger logger,
ProbeLevel minimumLevel)
Creates a MetricsRegistryImpl instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
collectMetrics(Object... objects)
For each object that implements
MetricsProvider the MetricsProvider.provideMetrics(MetricsRegistry)
is called. |
<S> void |
deregister(S source)
Deregisters all probes for a given source object.
|
void |
discardMetrics(Object... objects)
For each object that implements
DiscardableMetricsProvider the
DiscardableMetricsProvider.discardMetrics(MetricsRegistry) is called. |
Set<String> |
getNames()
Gets a set of all current probe names.
|
ProbeLevel |
minimumLevel()
Returns the minimum ProbeLevel this MetricsRegistry is recording.
|
DoubleGauge |
newDoubleGauge(String name)
Creates a
DoubleGauge for a given metric name. |
com.hazelcast.internal.metrics.impl.LongGaugeImpl |
newLongGauge(String name)
Creates a
LongGauge for a given metric name. |
ProbeBuilder |
newProbeBuilder()
Creates a new
ProbeBuilder. |
<S> void |
register(S source,
String name,
ProbeLevel level,
DoubleProbeFunction<S> function)
Registers a probe
If a probe for the given name exists, it will be overwritten.
|
<S> void |
register(S source,
String name,
ProbeLevel level,
LongProbeFunction<S> function)
Registers a probe.
|
void |
render(ProbeRenderer renderer)
Renders the content of the MetricsRegistry.
|
<S> void |
scanAndRegister(S source,
String namePrefix)
Scans the source object for any fields/methods that have been annotated
with
Probe annotation, and registers these fields/methods as
probe instances. |
void |
scheduleAtFixedRate(Runnable publisher,
long period,
TimeUnit timeUnit)
Schedules a publisher to be executed at a fixed rate.
|
void |
shutdown() |
public MetricsRegistryImpl(ILogger logger, ProbeLevel minimumLevel)
logger - the ILogger usedminimumLevel - the minimum ProbeLevel. If a probe is registered with a ProbeLevel lower than the minimum ProbeLevel,
then the registration is skipped.NullPointerException - if logger or minimumLevel is nullpublic MetricsRegistryImpl(String name, ILogger logger, ProbeLevel minimumLevel)
name - Name of the registrylogger - the ILogger usedminimumLevel - the minimum ProbeLevel. If a probe is registered with a ProbeLevel lower than the minimum ProbeLevel,
then the registration is skipped.NullPointerException - if logger or minimumLevel is nullpublic ProbeLevel minimumLevel()
MetricsRegistryminimumLevel in interface MetricsRegistrypublic Set<String> getNames()
MetricsRegistrygetNames in interface MetricsRegistrypublic <S> void scanAndRegister(S source,
String namePrefix)
MetricsRegistryProbe annotation, and registers these fields/methods as
probe instances.
If a probe is called 'queueSize' and the namePrefix is 'operations', then the name of the probe instance is 'operations.queueSize'.
If a probe with the same name already exists, then the probe is replaced.
If an object has no @Probe annotations, the call is ignored.
scanAndRegister in interface MetricsRegistrysource - the object to scan.namePrefix - the name prefix.public <S> void register(S source,
String name,
ProbeLevel level,
LongProbeFunction<S> function)
MetricsRegistryregister in interface MetricsRegistryname - the name of the probe.level - the ProbeLevelfunction - the probepublic <S> void register(S source,
String name,
ProbeLevel level,
DoubleProbeFunction<S> function)
MetricsRegistryregister in interface MetricsRegistryname - the name of the probelevel - the ProbeLevelfunction - the probepublic com.hazelcast.internal.metrics.impl.LongGaugeImpl newLongGauge(String name)
MetricsRegistryLongGauge for a given metric name.
If no gauge exists for the name, it will be created but no probe is set.
The reason to do so is that you don't want to depend on the order of
registration. Perhaps you want to read out e.g. operations.count gauge,
but the OperationService has not started yet and the metric is not yet
available. Another cause is that perhaps a probe is not registered, but
the metric is created. For example when experimenting with a new
implementation, e.g. a new OperationService implementation, that doesn't
provide the operation.count probe.
Multiple calls with the same name return different Gauge instances; so
the Gauge instance is not cached. This is done to prevent memory leaks.newLongGauge in interface MetricsRegistryname - the name of the metric.public DoubleGauge newDoubleGauge(String name)
MetricsRegistryDoubleGauge for a given metric name.newDoubleGauge in interface MetricsRegistryname - name of the metricMetricsRegistry.newLongGauge(String)public <S> void deregister(S source)
MetricsRegistryderegister in interface MetricsRegistrysource - the object to deregister. If called with null, then ignored.public void render(ProbeRenderer renderer)
MetricsRegistryrender in interface MetricsRegistryrenderer - the ProbeRendererpublic void collectMetrics(Object... objects)
MetricsRegistryMetricsProvider the MetricsProvider.provideMetrics(MetricsRegistry)
is called.collectMetrics in interface MetricsRegistryobjects - the array of objects to initialize.public void discardMetrics(Object... objects)
MetricsRegistryDiscardableMetricsProvider the
DiscardableMetricsProvider.discardMetrics(MetricsRegistry) is called.discardMetrics in interface MetricsRegistryobjects - the array of objects to check.public void scheduleAtFixedRate(Runnable publisher, long period, TimeUnit timeUnit)
MetricsRegistryscheduleAtFixedRate in interface MetricsRegistrypublisher - the published task that needs to be executedperiod - the time between executionstimeUnit - the timeunit for periodpublic void shutdown()
public ProbeBuilder newProbeBuilder()
MetricsRegistryProbeBuilder.newProbeBuilder in interface MetricsRegistryCopyright © 2018 Hazelcast, Inc.. All Rights Reserved.