java.lang.Object
io.prometheus.metrics.core.metrics.Metric
io.prometheus.metrics.core.metrics.MetricWithFixedMetadata
io.prometheus.metrics.core.metrics.StatefulMetric<DistributionDataPoint,Summary.DataPoint>
io.prometheus.metrics.core.metrics.Summary
- All Implemented Interfaces:
DataPoint,DistributionDataPoint,TimerApi,io.prometheus.metrics.model.registry.Collector
public class Summary
extends StatefulMetric<DistributionDataPoint,Summary.DataPoint>
implements DistributionDataPoint
Summary metric. Example:
Summary summary = Summary.builder()
.name("http_request_duration_seconds_hi")
.help("HTTP request service time in seconds")
.unit(SECONDS)
.labelNames("method", "path", "status_code")
.quantile(0.5, 0.01)
.quantile(0.95, 0.001)
.quantile(0.99, 0.001)
.register();
long start = System.nanoTime();
// process a request, duration will be observed
summary.labelValues("GET", "/", "200").observe(Unit.nanosToSeconds(System.nanoTime() - start));
See Summary.Builder for configuration options.-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class io.prometheus.metrics.core.metrics.MetricWithFixedMetadata
labelNamesFields inherited from class io.prometheus.metrics.core.metrics.Metric
constLabels -
Method Summary
Modifier and TypeMethodDescriptionstatic Summary.Builderbuilder()static Summary.Builderbuilder(io.prometheus.metrics.config.PrometheusProperties config) io.prometheus.metrics.model.snapshots.SummarySnapshotcollect()protected io.prometheus.metrics.model.snapshots.SummarySnapshotcollect(List<io.prometheus.metrics.model.snapshots.Labels> labels, List<Summary.DataPoint> metricData) labels and metricData have the same size. labels.get(i) are the labels for metricData.get(i).longgetCount()Get the count of observations.doublegetSum()Get the sum of all observed values.protected Summary.DataPointvoidobserve(double amount) Observevalue.voidobserveWithExemplar(double amount, io.prometheus.metrics.model.snapshots.Labels labels) Observevalue, and create a custom exemplar with the given labels.Methods inherited from class io.prometheus.metrics.core.metrics.StatefulMetric
clear, getConfigProperty, getMetricProperties, getNoLabels, initLabelValues, labelValues, remove, removeIfMethods inherited from class io.prometheus.metrics.core.metrics.MetricWithFixedMetadata
getMetadata, getPrometheusNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.prometheus.metrics.model.registry.Collector
collect, collect, collectMethods inherited from interface io.prometheus.metrics.core.datapoints.DistributionDataPoint
startTimerMethods inherited from interface io.prometheus.metrics.core.datapoints.TimerApi
time, time, timeChecked
-
Method Details
-
getSum
public double getSum()Description copied from interface:DistributionDataPointGet the sum of all observed values.- Specified by:
getSumin interfaceDistributionDataPoint
-
getCount
public long getCount()Description copied from interface:DistributionDataPointGet the count of observations.- Specified by:
getCountin interfaceDistributionDataPoint
-
observe
public void observe(double amount) Description copied from interface:DistributionDataPointObservevalue.- Specified by:
observein interfaceDistributionDataPoint
-
observeWithExemplar
public void observeWithExemplar(double amount, io.prometheus.metrics.model.snapshots.Labels labels) Description copied from interface:DistributionDataPointObservevalue, and create a custom exemplar with the given labels.- Specified by:
observeWithExemplarin interfaceDistributionDataPoint
-
collect
public io.prometheus.metrics.model.snapshots.SummarySnapshot collect()- Specified by:
collectin interfaceio.prometheus.metrics.model.registry.Collector- Overrides:
collectin classStatefulMetric<DistributionDataPoint,Summary.DataPoint>
-
collect
protected io.prometheus.metrics.model.snapshots.SummarySnapshot collect(List<io.prometheus.metrics.model.snapshots.Labels> labels, List<Summary.DataPoint> metricData) Description copied from class:StatefulMetriclabels and metricData have the same size. labels.get(i) are the labels for metricData.get(i).- Specified by:
collectin classStatefulMetric<DistributionDataPoint,Summary.DataPoint>
-
newDataPoint
- Specified by:
newDataPointin classStatefulMetric<DistributionDataPoint,Summary.DataPoint>
-
builder
-
builder
-