java.lang.Object
io.prometheus.metrics.core.metrics.Metric.Builder<StateSet.Builder,StateSet>
io.prometheus.metrics.core.metrics.MetricWithFixedMetadata.Builder<StateSet.Builder,StateSet>
io.prometheus.metrics.core.metrics.StateSet.Builder
- Enclosing class:
StateSet
public static class StateSet.Builder
extends MetricWithFixedMetadata.Builder<StateSet.Builder,StateSet>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Supplier<io.prometheus.metrics.model.snapshots.Labels> protected BooleanFields inherited from class io.prometheus.metrics.core.metrics.Metric.Builder
constLabels, illegalLabelNames, properties -
Method Summary
Modifier and TypeMethodDescriptionbuild()exemplarLabelsSupplier(Supplier<io.prometheus.metrics.model.snapshots.Labels> supplier) Provide additional labels to be merged into every automatically-sampled exemplar of this metric.io.prometheus.metrics.config.MetricsPropertiesOverride if there are more properties than just exemplars enabled.protected StateSet.Builderself()Declare the states that should be represented by this StateSet.Declare the states that should be represented by this StateSet.protected io.prometheus.metrics.config.MetricsPropertiesOverride if there are more properties than just exemplars enabled.Allow Exemplars for this metric.Turn off Exemplars for this metric.Methods inherited from class io.prometheus.metrics.core.metrics.MetricWithFixedMetadata.Builder
constLabels, help, labelNames, name, nameWithOriginal, unitMethods inherited from class io.prometheus.metrics.core.metrics.Metric.Builder
register, register
-
Field Details
-
exemplarsEnabled
-
exemplarLabelsSupplier
-
-
Method Details
-
states
Declare the states that should be represented by this StateSet. -
states
Declare the states that should be represented by this StateSet. -
build
- Specified by:
buildin classMetricWithFixedMetadata.Builder<StateSet.Builder,StateSet>
-
self
- Specified by:
selfin classMetricWithFixedMetadata.Builder<StateSet.Builder,StateSet>
-
exemplarLabelsSupplier
public StateSet.Builder exemplarLabelsSupplier(Supplier<io.prometheus.metrics.model.snapshots.Labels> supplier) 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. -
toProperties
protected io.prometheus.metrics.config.MetricsProperties toProperties()Override if there are more properties than just exemplars enabled. -
getDefaultProperties
public io.prometheus.metrics.config.MetricsProperties getDefaultProperties()Override if there are more properties than just exemplars enabled.
-