001package io.prometheus.metrics.core.datapoints; 002 003import io.prometheus.metrics.model.snapshots.Labels; 004 005/** 006 * Represents a single data point of a histogram or a summary metric. 007 * 008 * <p>Single data point means identified label values like {@code {method="GET", path="/", 009 * status_code="200"}}, ignoring the {@code "le"} label for histograms or the {@code "quantile"} 010 * label for summaries. 011 * 012 * <p>This interface is named <i>DistributionDataPoint</i> because both histograms and summaries are 013 * used to observe distributions, like latency distributions or distributions of request sizes. 014 * Therefore <i>DistributionDataPoint</i> is a good name for a common interface implemented by 015 * histogram data points and summary data points. 016 * 017 * <p>See JavaDoc of {@link CounterDataPoint} on how using data points directly can improve 018 * performance. 019 */ 020public interface DistributionDataPoint extends DataPoint, TimerApi { 021 022 /** Observe {@code value}. */ 023 void observe(double value); 024 025 /** Observe {@code value}, and create a custom exemplar with the given labels. */ 026 void observeWithExemplar(double value, Labels labels); 027 028 @Override 029 default Timer startTimer() { 030 return new Timer(this::observe); 031 } 032}