Interface DistributionDataPoint
- All Known Implementing Classes:
Histogram, Histogram.DataPoint, Summary, Summary.DataPoint
Represents a single data point of a histogram or a summary metric.
Single data point means identified label values like {method="GET", path="/",
status_code="200"}, ignoring the "le" label for histograms or the "quantile"
label for summaries.
This interface is named DistributionDataPoint because both histograms and summaries are used to observe distributions, like latency distributions or distributions of request sizes. Therefore DistributionDataPoint is a good name for a common interface implemented by histogram data points and summary data points.
See JavaDoc of CounterDataPoint on how using data points directly can improve
performance.
-
Method Summary
Modifier and TypeMethodDescriptionlonggetCount()Get the count of observations.doublegetSum()Get the sum of all observed values.voidobserve(double value) Observevalue.voidobserveWithExemplar(double value, Labels labels) Observevalue, and create a custom exemplar with the given labels.default TimerStart aTimer.Methods inherited from interface TimerApi
time, time, timeChecked
-
Method Details
-
getCount
long getCount()Get the count of observations. -
getSum
double getSum()Get the sum of all observed values. -
observe
Observevalue. -
observeWithExemplar
Observevalue, 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
-