NewStopWatch
Creates a new labeled stopwatch. Label keys must be set before instantiating a counter. See labeled.SetMetricsKeys for information about how to configure that.
def NewStopWatch(
name: string,
description: string,
scale: time.Duration,
scope: promutils.Scope,
opts: ...MetricOption
) - > StopWatch
NewStopWatch creates a new labeled stopwatch. Label keys must be set before instantiating a counter. See labeled.SetMetricsKeys for information about how to configure that.
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | The name of the stopwatch, which will be sanitized for Prometheus metric naming conventions. |
| description | string | A descriptive string for the stopwatch, providing context for its purpose. |
| scale | time.Duration | The time unit scale for the stopwatch, determining how durations are measured (e.g., seconds, milliseconds). |
| scope | promutils.Scope | The Prometheus scope to which this stopwatch will be registered, managing its lifecycle and exposure. |
| opts | ...MetricOption | Optional configurations for the stopwatch, such as emitting an unlabeled metric or adding additional labels. These options modify how the stopwatch is created and behaves. |
Returns
| Type | Description |
|---|---|
StopWatch | A new StopWatch instance configured with the specified name, description, scale, and labels. |