diff --git a/pkg/sensors/tracing/kprobe_test.go b/pkg/sensors/tracing/kprobe_test.go index ea8025cf10d..b8b49c87a52 100644 --- a/pkg/sensors/tracing/kprobe_test.go +++ b/pkg/sensors/tracing/kprobe_test.go @@ -7013,14 +7013,22 @@ spec: fmt.Printf("Failed to execute test binary: %s\n", err) } - expected := strings.NewReader(` # HELP tetragon_missed_prog_probes_total The total number of Tetragon probe missed by program. + s := ` # HELP tetragon_missed_prog_probes_total The total number of Tetragon probe missed by program. # TYPE tetragon_missed_prog_probes_total counter tetragon_missed_prog_probes_total{attach="acct_process",policy="__base__"} 0 -tetragon_missed_prog_probes_total{attach="kprobe_multi (2 functions)",policy="syswritefollowfdpsswd"} 1 +tetragon_missed_prog_probes_total{attach="kprobe_session (2 functions)",policy="syswritefollowfdpsswd"} %d tetragon_missed_prog_probes_total{attach="sched/sched_process_exec",policy="__base__"} 0 tetragon_missed_prog_probes_total{attach="security_bprm_committing_creds",policy="__base__"} 0 tetragon_missed_prog_probes_total{attach="wake_up_new_task",policy="__base__"} 0 -`) +` + + // Session programs get accounted missed counts also for return + // probe even if it's not executed. + missed := 1 + if bpf.HasKprobeSession() { + missed = 2 + } + expected := strings.NewReader(fmt.Sprintf(s, missed)) assert.NoError(t, testutil.GatherAndCompare(metricsconfig.GetRegistry(), expected, prometheus.BuildFQName(consts.MetricsNamespace, "", "missed_prog_probes_total")))