Skip to main content

HistogramStopWatchVec

HistogramStopWatchVec implements a stopwatch style interface that works with prometheus histogram

Methods


WithLabelValues()

@classmethod
def WithLabelValues(
values: string
) - > [HistogramStopWatch](labeled/histogramstopwatch.md?sid=flytestdlib_promutils_labeled_histogramstopwatch)

Retrieves a HistogramStopWatch instance with specific label values. Call this method to obtain a stopwatch that will record observations with the provided labels.

Parameters

NameTypeDescription
valuesstringThe label values to associate with the HistogramStopWatch. These values correspond to the labels defined when the HistogramStopWatchVec was created.

Returns

TypeDescription
[HistogramStopWatch](labeled/histogramstopwatch.md?sid=flytestdlib_promutils_labeled_histogramstopwatch)A HistogramStopWatch instance configured with the specified label values.

GetMetricWith()

@classmethod
def GetMetricWith(
labels: prometheus.Labels
) - > ([HistogramStopWatch](labeled/histogramstopwatch.md?sid=flytestdlib_promutils_labeled_histogramstopwatch), error)

Retrieves a HistogramStopWatch instance for a given set of Prometheus labels. This method allows you to get a specific stopwatch metric by providing a map of label names to their values.

Parameters

NameTypeDescription
labelsprometheus.LabelsA map of label names to their corresponding string values, used to identify the specific HistogramStopWatch metric.

Returns

TypeDescription
([HistogramStopWatch](labeled/histogramstopwatch.md?sid=flytestdlib_promutils_labeled_histogramstopwatch), error)A tuple containing the HistogramStopWatch instance and an error if the metric could not be retrieved or created.