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 voiddec()Subtract one.default voiddec(double amount) Subtractamount.default voiddecWithExemplar(double amount, Labels labels) Subtractamount, and create a custom exemplar with the given labels.default voiddecWithExemplar(Labels labels) Subtract one, and create a custom exemplar with the given labels.doubleget()Get the current value.default voidinc()Add one.voidinc(double amount) Addamount.voidincWithExemplar(double amount, Labels labels) Addamount, and create a custom exemplar with the given labels.default voidincWithExemplar(Labels labels) Add one, and create a custom exemplar with the given labels.voidset(double value) Set the gauge tovalue.voidsetWithExemplar(double value, Labels labels) Set the gauge tovalue, and create a custom exemplar with the given labels.default TimerStart 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:TimerApiStart 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:
startTimerin interfaceTimerApi
-