public class GaugeMetric extends Object
Gauge<Long>
and compare it with a baseline.
Most methods on this class will treat a non-existent gauge as having a value of zero to allow implementations to lazily create metrics.
Most tests should use MetricGetter
to create instances of this class.
Constructor and Description |
---|
GaugeMetric(MetricRegistryProxy registry,
org.eclipse.microprofile.metrics.MetricID metricId) |
Modifier and Type | Method and Description |
---|---|
void |
baseline()
Capture the current counter value for later comparison with
delta() |
long |
delta()
Return the difference between the current value of the metric and the value when
baseline was called. |
Optional<org.eclipse.microprofile.metrics.Gauge<Long>> |
gauge()
Return the actual
Counter object for the metric, if it exists. |
long |
value()
Get the counter value, or zero if the metric doesn't exist
|
public GaugeMetric(MetricRegistryProxy registry, org.eclipse.microprofile.metrics.MetricID metricId)
public long value()
This method will not create the metric if it does not exist.
public void baseline()
delta()
This method will not create the metric if it does not exist.
public long delta()
baseline
was called.Copyright © 2016 – 2021 Eclipse Foundation. All rights reserved.
Use is subject to license terms.