Counter
Counter represents a counter labeled with values from the context. See labeled.SetMetricsKeys for information about to configure that.
Attributes
| Attribute | Type | Description |
|---|---|---|
| CounterVec | *prometheus.CounterVec | This embedded field provides the functionality of a Prometheus CounterVec, allowing the Counter to manage a collection of counters with different label values. |
| Counter | prometheus.Counter | This embedded field provides the functionality of a Prometheus Counter, allowing the Counter to increment a single metric. |
Methods
Inc()
@classmethod
def Inc(
ctx: context.Context
)
Increments the counter by 1. This method is used to record occurrences of an event.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the operation, which may contain labels to associate with the counter. |
Add()
@classmethod
def Add(
ctx: context.Context,
v: float64
)
Adds a specified value to the counter. This method is used to record the magnitude of an event.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the operation, which may contain labels to associate with the counter. |
| v | float64 | The value to add to the counter. This value must be non-negative. |