Skip to content

Commit

Permalink
kprobemetrics: Fix collecting missed metrics
Browse files Browse the repository at this point in the history
When collecting metrics from kernel, Tetragon needs to aggregate them in
userspace maps to avoid duplicate labelsets, which cause metrics server errors.
This was done incorrectly, using a pointer to missedKey struct as the
aggregation key. Use missedKey struct directly.

Signed-off-by: Anna Kapuscinska <[email protected]>
  • Loading branch information
lambdanis authored and jrfastab committed Aug 14, 2024
1 parent 25a43a0 commit 99f611e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/metrics/kprobemetrics/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ type missedKey struct {
func collect(ch chan<- prometheus.Metric) {
allPrograms := sensors.AllPrograms()

mapProg := make(map[*missedKey]uint64)
mapLink := make(map[*missedKey]uint64)
mapProg := make(map[missedKey]uint64)
mapLink := make(map[missedKey]uint64)

// Group all the metrics together so we avoid of duplicate
// metric values due to missing policy name.
Expand All @@ -88,7 +88,7 @@ func collect(ch chan<- prometheus.Metric) {
continue
}

key := &missedKey{load.Policy, load.Attach}
key := missedKey{load.Policy, load.Attach}

if okLink {
mapLink[key] = mapLink[key] + valLink
Expand Down

0 comments on commit 99f611e

Please sign in to comment.