public class MetricTaggerImpl extends Object implements MetricTagger
MetricTagger
.Modifier and Type | Method and Description |
---|---|
String |
metricId()
Returns the id for the metric.
|
String |
metricName()
Returns the name for the metric.
|
<S> void |
registerStaticMetrics(S source)
Scans the source object for any fields/methods that have been annotated
with
Probe annotation, and registers these fields/methods as
probe instances. |
<S> void |
registerStaticProbe(S source,
String metricName,
ProbeLevel level,
DoubleProbeFunction<S> probe)
Registers a single probe.
|
<S> void |
registerStaticProbe(S source,
String metricName,
ProbeLevel level,
LongProbeFunction<S> probe)
Registers a single probe.
|
<S> void |
registerStaticProbe(S source,
String metricName,
ProbeLevel level,
ProbeUnit unit,
DoubleProbeFunction<S> probe)
Registers a single probe.
|
<S> void |
registerStaticProbe(S source,
String metricName,
ProbeLevel level,
ProbeUnit unit,
LongProbeFunction<S> probe)
Registers a single probe.
|
MetricTaggerImpl |
withIdTag(String tag,
String value)
Returns a new MetricTagger instance with the given identifier tag
added.
|
MetricTaggerImpl |
withMetricTag(String metricName)
Returns a new MetricTagger instance with the given metric name tag
added.
|
MetricTaggerImpl |
withTag(String tag,
String value)
Returns a new MetricTagger instance with the given general purpose tag added.
|
@CheckReturnValue public MetricTaggerImpl withTag(String tag, String value)
MetricTagger
withTag
in interface MetricTagger
tag
- The name of the tagvalue
- The value of the tag@CheckReturnValue public MetricTaggerImpl withIdTag(String tag, String value)
MetricTagger
MetricsRegistryImpl
in the key of the tag as a discriminator if the metric built with
this MetricTagger is a static metric.withIdTag
in interface MetricTagger
tag
- The name of the tagvalue
- The value of the tagMetricTagger.metricId()
public MetricTaggerImpl withMetricTag(String metricName)
MetricTagger
withMetricTag
in interface MetricTagger
metricName
- The value of the tagpublic String metricName()
MetricTagger
MetricsCollector
s
and MetricsPublisher
s. The returned format is like
[name=myMap,unit=count,metric=map.entryCount]
.metricName
in interface MetricTagger
public String metricId()
MetricTagger
MetricsRegistryImpl
as the key of the static metric built with this MetricTagger. The
returned format is map[myMap].entryCount
.
The purpose of the metricId is to make creating Gauge
s easier
and less error prone. With the MetricTagger.metricName()
, changing the
order of the tags, adding/removing tags break existing gauges.metricId
in interface MetricTagger
public <S> void registerStaticProbe(@Nonnull S source, @Nonnull String metricName, @Nonnull ProbeLevel level, @Nonnull ProbeUnit unit, @Nonnull DoubleProbeFunction<S> probe)
MetricTagger
If a probe for the given name exists, it will be overwritten silently.
registerStaticProbe
in interface MetricTagger
source
- the object to pass to probeFnmetricName
- the value of "metric" taglevel
- the ProbeLevelunit
- the unitprobe
- the probe functionpublic <S> void registerStaticProbe(@Nonnull S source, @Nonnull String metricName, @Nonnull ProbeLevel level, @Nonnull DoubleProbeFunction<S> probe)
MetricTagger
If a probe for the given name exists, it will be overwritten silently.
registerStaticProbe
in interface MetricTagger
source
- the object to pass to probeFnmetricName
- the value of "metric" taglevel
- the ProbeLevelprobe
- the probe functionpublic <S> void registerStaticProbe(@Nonnull S source, @Nonnull String metricName, @Nonnull ProbeLevel level, @Nonnull ProbeUnit unit, @Nonnull LongProbeFunction<S> probe)
MetricTagger
If a probe for the given name exists, it will be overwritten silently.
registerStaticProbe
in interface MetricTagger
source
- the object to pass to probeFnmetricName
- the value of "metric" taglevel
- the ProbeLevelunit
- the unitprobe
- the probe functionpublic <S> void registerStaticProbe(@Nonnull S source, @Nonnull String metricName, @Nonnull ProbeLevel level, @Nonnull LongProbeFunction<S> probe)
MetricTagger
If a probe for the given name exists, it will be overwritten silently.
registerStaticProbe
in interface MetricTagger
source
- the object to pass to probeFnmetricName
- the value of "metric" taglevel
- the ProbeLevelprobe
- the probe functionpublic <S> void registerStaticMetrics(S source)
MetricTagger
Probe
annotation, and registers these fields/methods as
probe instances.
If a probe with the same name already exists, the probe is overwritten silently.
If an object has no @Probe annotations, the call is ignored.
registerStaticMetrics
in interface MetricTagger
source
- the object to scanCopyright © 2019 Hazelcast, Inc.. All rights reserved.