public interface MetricsRegistry
Probe
instances. A probe is registered under a certain name,
and can be read by creating a Gauge, see newLongGauge(String)
.
This name can be any string, e.g.:
Modifier and Type | Method and Description |
---|---|
<S> void |
deregister(S source)
Deregisters all probes for a given source object.
|
Set<String> |
getNames()
Gets a set of all current probe names.
|
DoubleGauge |
newDoubleGauge(String name)
Creates a DoubleProbe for a given metric name.
|
LongGauge |
newLongGauge(String name)
Creates a LongGauge for a given metric name.
|
<S> void |
register(S source,
String name,
ProbeLevel level,
DoubleProbeFunction<S> probe)
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> probe)
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
registering these fields/methods as probes instances. |
void |
scheduleAtFixedRate(Runnable publisher,
long period,
TimeUnit timeUnit)
Schedules a publisher to be executed at a fixed rate.
|
LongGauge newLongGauge(String name)
name
- the name of the metric.NullPointerException
- if name is null.DoubleGauge newDoubleGauge(String name)
name
- name of the metricNullPointerException
- if name is null.newLongGauge(String)
Set<String> getNames()
<S> void scanAndRegister(S source, String namePrefix)
Probe
annotation, and
registering these fields/methods as probes instances.
If a probe is called, 'queueSize' and the namePrefix is 'operations, then the name of the probe-instance
is 'operations.queueSize'.
If probes with the same name already exist, then the probes are replaced.
If an object has no @Gauge annotations, the call is ignored.source
- the object to scan.namePrefix
- the name prefix.NullPointerException
- if namePrefix or source is null.IllegalArgumentException
- if the source contains Gauge annotation on a field/method of unsupported type.<S> void register(S source, String name, ProbeLevel level, LongProbeFunction<S> probe)
name
- the name of the probe.level
- the ProbeLevelprobe
- the probeNullPointerException
- if source, name, level or probe is null.<S> void register(S source, String name, ProbeLevel level, DoubleProbeFunction<S> probe)
name
- the name of the probelevel
- the ProbeLevelprobe
- the probeNullPointerException
- if source, name, level or probe is null.<S> void deregister(S source)
source
- the object to deregisterNullPointerException
- if source is null.void scheduleAtFixedRate(Runnable publisher, long period, TimeUnit timeUnit)
publisher
- the published task that needs to be executedperiod
- the time between executionstimeUnit
- the timeunit for periodNullPointerException
- if publisher or timeUnit is null.void render(ProbeRenderer renderer)
renderer
- the ProbeRendererNullPointerException
- if renderer is null.Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.