You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pkg/metrics package provides functions to define metrics, which provide a few features on top of regular prometheus functions:
define possible values for labels with known values
define example values for metrics with unknown values
initialize metrics with known labelsets at startup - for metrics with only constrained labels this is done automatically for all label combinations, but initialization function can be also provided explicitly
Ideally metrics with variable labels (defined with prometheus.New*Vec) should be migrated to use new helpers. This gives us a few benefits:
Metrics are initialized at startup without the need for a separate initialization function defined and called somewhere else in the code (this was the tricky part of defining metrics so far, devs just needed to know that they should write initialization code).
Metrics reference doc is generated using labels provided in the metric definition, not a separate initialization function (this is particularly useful for metrics with unconstrained labels, as they needed separate "example" label values for docs, and custom collectors, they needed whole separate types for docs).
For labels with known values these values are constrained at runtime (this ensures that metrics cardinality and related resources usage are stable).
Note that there's little point in migrating metrics with no variable labels (defined e.g. with prometheus.NewCounter no Vec).
pkg/metrics
package provides functions to define metrics, which provide a few features on top of regular prometheus functions:Ideally metrics with variable labels (defined with
prometheus.New*Vec
) should be migrated to use new helpers. This gives us a few benefits:Note that there's little point in migrating metrics with no variable labels (defined e.g. with
prometheus.NewCounter
noVec
).Examples:
tetragon_policyfilter_operations_total: 6feacec
The text was updated successfully, but these errors were encountered: