Skip to content

Commit

Permalink
eventcachemetrics: Initialize metrics with labels
Browse files Browse the repository at this point in the history
Initialize tetragon_event_cache_retries_total with all possible entry types.

Initialize tetragon_event_cache_<entry_type>_errors_total with all possible
event types.

Initialize tetragon_event_cache_errors_total with all (one) possible errors and
all possible event types.

Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
  • Loading branch information
lambdanis committed Feb 26, 2024
1 parent ae7c832 commit de3fe08
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions pkg/metrics/eventcachemetrics/eventcachemetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,19 @@ func InitMetrics(registry *prometheus.Registry) {
registerMetrics(registry)

// Initialize metrics with labels
// TODO:
// event_cache_process_info_errors_total: list all possible event types
// event_cache_pod_info_errors_total: list all possible event types
// event_cache_errors_total: list all possible errors
// event_cache_retries_total: list all possible entry types
// event_cache_parent_info_errors_total: list all possible event types

for en := range cacheEntryTypeLabelValues {
EventCacheRetries(en)
}
for ev := range tetragon.EventType_name {
if tetragon.EventType(ev) != tetragon.EventType_UNDEF && tetragon.EventType(ev) != tetragon.EventType_TEST {
ProcessInfoError(tetragon.EventType(ev)).Add(0)
PodInfoError(tetragon.EventType(ev)).Add(0)
ParentInfoError(tetragon.EventType(ev)).Add(0)
for er := range cacheErrorLabelValues {
EventCacheError(er, tetragon.EventType(ev)).Add(0)
}
}
}
// NOTES:
// * Consider merging some metrics together (e.g. keep one errors metric with event_type and error labels)
// * error, error_type, type - standardize on a label
Expand Down

0 comments on commit de3fe08

Please sign in to comment.