Skip to content

Commit

Permalink
observer: Initialize metrics with labels
Browse files Browse the repository at this point in the history
Initialize tetragon_data_events_total with all possible events.

Initialize tetragon_data_event_size with all possible operations. It's a
histogram with quite large number of buckets (20), but only two possible labels
values, so it should be okay.

Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
  • Loading branch information
lambdanis committed Feb 28, 2024
1 parent 450f977 commit 0ae9250
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/observer/data_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ func registerMetrics(registry *prometheus.Registry) {
func InitMetrics(registry *prometheus.Registry) {
registerMetrics(registry)

// Initialize metrics with labels
for _, ev := range DataEventTypeStrings {
DataEventStats.WithLabelValues(ev).Add(0)
}
DataEventSizeHist.WithLabelValues(DataEventOpOk.String())
DataEventSizeHist.WithLabelValues(DataEventOpBad.String())

// NOTES:
// * Don't confuse op and opcode labels
// * Don't confuse event and event_type labels
Expand Down

0 comments on commit 0ae9250

Please sign in to comment.