Skip to main content

HistogramStopWatchVec

HistogramStopWatchVec implements a stopwatch style interface that works with prometheus histogram

Methods​


WithLabelValues()​

@classmethod
def WithLabelValues(
values: string
) - > HistogramStopWatch

Retrieves a HistogramStopWatch instance with specific label values. Callers use this to obtain a stopwatch for a particular set of metric dimensions.

Parameters​

NameTypeDescription
valuesstringThe label values to associate with the HistogramStopWatch, typically provided as a variadic argument list.

Returns​

TypeDescription
HistogramStopWatchA HistogramStopWatch instance configured with the provided label values.

GetMetricWith()​

@classmethod
def GetMetricWith(
labels: prometheus.Labels
) - > (HistogramStopWatch, error)

Retrieves a HistogramStopWatch instance associated with the given Prometheus labels. This method allows callers to get a specific metric vector element for observation.

Parameters​

NameTypeDescription
labelsprometheus.LabelsA map of label names to label values used to identify the specific metric vector element.

Returns​

TypeDescription
(HistogramStopWatch, error)A tuple containing the HistogramStopWatch instance and an error if the metric could not be retrieved or created.