Skip to content

Commit 79cebb6

Browse files
i3149Copilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 87e4c1e commit 79cebb6

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

pkg/formats/otel/otel.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,19 @@ func (f *OtelFormat) To(msgs []*kt.JCHF, serBuf []byte) (*kt.Output, error) {
235235
default:
236236
f.metrics.ExportDrops.Inc(1)
237237
if !f.warnFull[m.Name] {
238-
f.Warnf("OTEL channel full, dropping sample for metric=%s", m.Name)
239238
f.mux.RUnlock()
240239
f.mux.Lock()
241-
f.warnFull[m.Name] = true
240+
firstWarn := !f.warnFull[m.Name]
241+
if firstWarn {
242+
f.warnFull[m.Name] = true
243+
}
242244
f.mux.Unlock()
243245
f.mux.RLock()
246+
if firstWarn {
247+
f.Warnf("OTEL channel full, dropping sample for metric=%s", m.Name)
248+
} else {
249+
f.Debugf("OTEL channel full, dropping sample for metric=%s", m.Name)
250+
}
244251
} else {
245252
f.Debugf("OTEL channel full, dropping sample for metric=%s", m.Name)
246253
}

0 commit comments

Comments
 (0)