From 774659d84905667e90c3060d80b58d9d6c0aee6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Julia=CC=81n?= Date: Thu, 9 Jan 2025 18:02:09 +0100 Subject: [PATCH] Fix signature --- pkg/ebpf/telemetry/modifier.go | 8 +++++++- pkg/ebpf/telemetry/modifier_test.go | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/ebpf/telemetry/modifier.go b/pkg/ebpf/telemetry/modifier.go index dc9f69ef9b43f0..52d0f127d4e8dc 100644 --- a/pkg/ebpf/telemetry/modifier.go +++ b/pkg/ebpf/telemetry/modifier.go @@ -13,6 +13,7 @@ import ( manager "github.com/DataDog/ebpf-manager" + ddebpf "github.com/DataDog/datadog-agent/pkg/ebpf" "github.com/DataDog/datadog-agent/pkg/ebpf/maps" "github.com/DataDog/datadog-agent/pkg/ebpf/names" "github.com/DataDog/datadog-agent/pkg/util/log" @@ -28,6 +29,11 @@ const ( // ErrorsTelemetryModifier is a modifier that sets up the manager to handle eBPF telemetry. type ErrorsTelemetryModifier struct{} +// Ensure it implements the required interfaces +var _ ddebpf.ModifierBeforeInit = &ErrorsTelemetryModifier{} +var _ ddebpf.ModifierAfterInit = &ErrorsTelemetryModifier{} +var _ ddebpf.ModifierBeforeStop = &ErrorsTelemetryModifier{} + // String returns the name of the modifier. func (t *ErrorsTelemetryModifier) String() string { return "ErrorsTelemetryModifier" @@ -172,7 +178,7 @@ func (t *ErrorsTelemetryModifier) AfterInit(m *manager.Manager, module names.Mod } // BeforeStop stops the perf collector from telemetry and removes the modules from the telemetry maps. -func (t *ErrorsTelemetryModifier) BeforeStop(m *manager.Manager, module names.ModuleName) error { +func (t *ErrorsTelemetryModifier) BeforeStop(m *manager.Manager, module names.ModuleName, _ manager.MapCleanupType) error { if errorsTelemetry == nil { return nil } diff --git a/pkg/ebpf/telemetry/modifier_test.go b/pkg/ebpf/telemetry/modifier_test.go index b3354a8f80ac15..fb868b9193c081 100644 --- a/pkg/ebpf/telemetry/modifier_test.go +++ b/pkg/ebpf/telemetry/modifier_test.go @@ -99,7 +99,7 @@ func TestModifierAppliesMultipleTimes(t *testing.T) { require.NotEmpty(t, metrics, "No metrics collected on try %d", i) // Run our BeforeStop - err = modifier.BeforeStop(mgr, mname) + err = modifier.BeforeStop(mgr, mname, manager.CleanAll) require.NoError(t, err, "BeforeStop failed on try %d", i) // Stop the manager