Skip to content

Commit

Permalink
Fix condition to disable BPF collector (#1538)
Browse files Browse the repository at this point in the history
  • Loading branch information
marctc authored Jan 17, 2025
1 parent afd346a commit 52e6cde
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/export/prom/prom_bpf.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ 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)
return collector.reportMetrics, nil
}
}

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,
Expand Down

0 comments on commit 52e6cde

Please sign in to comment.