Interface GaugeDataPoint
- All Known Implementing Classes:
Gauge
Represents a single gauge data point, i.e. a single line for a gauge metric in Prometheus text
format.
See JavaDoc of CounterDataPoint
on how using data points directly can improve
performance.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
dec()
Subtract one.default void
dec
(double amount) Subtractamount
.default void
decWithExemplar
(double amount, Labels labels) Subtractamount
, and create a custom exemplar with the given labels.default void
decWithExemplar
(Labels labels) Subtract one, and create a custom exemplar with the given labels.double
get()
Get the current value.default void
inc()
Add one.void
inc
(double amount) Addamount
.void
incWithExemplar
(double amount, Labels labels) Addamount
, and create a custom exemplar with the given labels.default void
incWithExemplar
(Labels labels) Add one, and create a custom exemplar with the given labels.void
set
(double value) Set the gauge tovalue
.void
setWithExemplar
(double value, Labels labels) Set the gauge tovalue
, and create a custom exemplar with the given labels.default Timer
Start aTimer
.Methods inherited from interface TimerApi
time, time, timeChecked
-
Method Details
-
inc
Add one. -
inc
Addamount
. -
incWithExemplar
Add one, and create a custom exemplar with the given labels. -
incWithExemplar
Addamount
, and create a custom exemplar with the given labels. -
dec
Subtract one. -
dec
Subtractamount
. -
decWithExemplar
Subtract one, and create a custom exemplar with the given labels. -
decWithExemplar
Subtractamount
, and create a custom exemplar with the given labels. -
set
Set the gauge tovalue
. -
get
double get()Get the current value. -
setWithExemplar
Set the gauge tovalue
, and create a custom exemplar with the given labels. -
startTimer
Description copied from interface:TimerApi
Start aTimer
. Example:
Durations are recorded in seconds. The Prometheus instrumentation guidelines say: "Metrics must use base units (e.g. seconds, bytes) and leave converting them to something more readable to graphing tools".Histogram histogram = Histogram.builder() .name("http_request_duration_seconds") .help("HTTP request service time in seconds") .unit(SECONDS) .labelNames("method", "path") .register(); try (Timer timer = histogram.labelValues("GET", "/").startTimer()) { // duration of this code block will be observed. }
- Specified by:
startTimer
in interfaceTimerApi
-