Skip to main content

NewGauge

NewGauge creates a new labeled gauge. Label keys must be set before instantiating. If the unlabeled option is given, this object will also instantiate and emit another gauge with the given name with an _unlabeled suffix. See labeled.SetMetricsKeys for information about how to configure that.

def NewGauge(
name: string,
description: string,
scope: promutils.Scope,
opts: ...MetricOption
) - > Gauge

Creates a new labeled gauge. Label keys must be set before instantiating. If the unlabeled option is given, this object will also instantiate and emit another gauge with the given name with an _unlabeled suffix. See labeled.SetMetricsKeys for information about how to configure that.

Parameters

NameTypeDescription
namestringThe name of the gauge. This name will be sanitized for Prometheus compatibility.
descriptionstringA descriptive string explaining the purpose of the gauge.
scopepromutils.ScopeThe Prometheus scope to which this gauge will be registered.
opts...MetricOptionOptional configurations for the gauge, such as EmitUnlabeledMetricOption to emit an additional unlabeled gauge, or AdditionalLabelsOption to specify extra labels.

Returns

TypeDescription
GaugeA new Gauge object configured with the specified name, description, scope, and options.