diff --git a/pkg/export/prom/prom_bpf.go b/pkg/export/prom/prom_bpf.go index 0274b02a6..926fac355 100644 --- a/pkg/export/prom/prom_bpf.go +++ b/pkg/export/prom/prom_bpf.go @@ -60,7 +60,7 @@ func BPFMetrics( cfg *PrometheusConfig, ) pipe.FinalProvider[[]request.Span] { return func() (pipe.FinalFunc[[]request.Span], error) { - if !cfg.EndpointEnabled() && !cfg.EBPFEnabled() { + if !bpfCollectorEnabled(cfg) { return pipe.IgnoreFinal[[]request.Span](), nil } collector := newBPFCollector(ctx, ctxInfo, cfg) @@ -68,6 +68,10 @@ func BPFMetrics( } } +func bpfCollectorEnabled(cfg *PrometheusConfig) bool { + return cfg.EndpointEnabled() && cfg.EBPFEnabled() +} + func newBPFCollector(ctx context.Context, ctxInfo *global.ContextInfo, cfg *PrometheusConfig) *BPFCollector { c := &BPFCollector{ cfg: cfg,