Class Summary.Builder
- Enclosing class:
Summary
public static class Summary.Builder
extends MetricWithFixedMetadata.Builder<Summary.Builder, Summary>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long5 minutes.static final int5. -
Method Summary
Modifier and TypeMethodDescriptionbuild()exemplarLabelsSupplier(Supplier<Labels> supplier) Provide additional labels to be merged into every automatically-sampled exemplar of this metric.Default properties for summary metrics.maxAgeSeconds(long maxAgeSeconds) The quantiles are relative to a moving time window.numberOfAgeBuckets(int ageBuckets) The quantiles are relative to a moving time window.quantile(double quantile) Add a quantile.quantile(double quantile, double error) Add a quantile.Allow Exemplars for this metric.Turn off Exemplars for this metric.Methods inherited from class MetricWithFixedMetadata.Builder
constLabels, help, labelNames, name, unit
-
Field Details
-
DEFAULT_MAX_AGE_SECONDS
5 minutes. SeemaxAgeSeconds(long). -
DEFAULT_NUMBER_OF_AGE_BUCKETS
-
-
Method Details
-
quantile
Add a quantile. Seequantile(double, double).Default errors are:
- error = 0.001 if quantile <= 0.01 or quantile >= 0.99
- error = 0.005 if quantile <= 0.02 or quantile >= 0.98
- error = 0.01 else.
-
quantile
Add a quantile. Call multiple times to add multiple quantiles.Example: The following will track the 0.95 quantile:
The second argument is the acceptable error margin, i.e. with the code above the quantile will not be exactly the 0.95 quantile but something between 0.949 and 0.951..quantile(0.95, 0.001)There are two special cases:
.quantile(0.0, 0.0)gives you the minimum observed value.quantile(1.0, 0.0)gives you the maximum observed value
-
maxAgeSeconds
The quantiles are relative to a moving time window.maxAgeSecondsis the size of that time window. Default isDEFAULT_MAX_AGE_SECONDS. -
numberOfAgeBuckets
The quantiles are relative to a moving time window. ThenumberOfAgeBucketsdefines how smoothly the time window moves forward. For example, if the time window is 5 minutes and has 5 age buckets, then it is moving forward every minute by one minute. Default isDEFAULT_NUMBER_OF_AGE_BUCKETS. -
getDefaultProperties
Default properties for summary metrics. -
build
- Specified by:
buildin classMetricWithFixedMetadata.Builder<Summary.Builder, Summary>
-
exemplarLabelsSupplier
Provide additional labels to be merged into every automatically-sampled exemplar of this metric. The supplier is called each time an exemplar is sampled, so it can return dynamic values (e.g. a request-scoped identifier from a thread-local). The supplier is only invoked when a valid, sampled span context is present; it has no effect when tracing is not active.For a global supplier that applies to all metrics (including metrics registered by third-party libraries you do not control), see
ExemplarLabelsSupplier. When both are configured, this per-metric supplier takes precedence over the global one on a label-name collision, and the reservedtrace_id/span_idlabels always win over both. Labels that collide are silently dropped. -
withExemplars
Allow Exemplars for this metric. -
withoutExemplars
Turn off Exemplars for this metric.
-