Skip to content

Commit c9783a5

Browse files
authored
Fix custom labels disabling (#3076)
1 parent dcc87a7 commit c9783a5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

main.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,17 @@ func mainWithExitCode() flags.ExitCode {
289289
includeTracers.Disable(goTracer)
290290
}
291291

292-
// Add golabels tracer when collect-custom-labels is true
293-
if f.CollectCustomLabels {
294-
if goLabelsTracer := tracertypes.Labels; !includeTracers.Has(goLabelsTracer) {
292+
// Enable/disable golabels tracer based on collect-custom-labels flag
293+
if goLabelsTracer := tracertypes.Labels; f.CollectCustomLabels {
294+
if !includeTracers.Has(goLabelsTracer) {
295295
log.Debug("Adding 'golabels' tracer due to collect-custom-labels being enabled")
296296
includeTracers.Enable(goLabelsTracer)
297297
}
298+
} else {
299+
if includeTracers.Has(goLabelsTracer) {
300+
log.Debug("Removing 'golabels' tracer due to collect-custom-labels being disabled")
301+
includeTracers.Disable(goLabelsTracer)
302+
}
298303
}
299304

300305
var relabelConfigs []*relabel.Config

0 commit comments

Comments
 (0)