Skip to content

Commit df6f222

Browse files
committed
only logging at warn level once for metric drop
1 parent c091bfe commit df6f222

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

pkg/formats/otel/otel.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ type OtelFormat struct {
4242
trapLog *OtelLogger
4343
logTee chan string
4444
metrics *OtelMetrics
45+
warnFull map[string]bool
4546
}
4647

4748
const (
@@ -88,6 +89,7 @@ func NewFormat(ctx context.Context, log logger.Underlying, cfg *ktranslate.OtelF
8889
config: cfg,
8990
inputs: map[string]chan OtelData{},
9091
logTee: logTee,
92+
warnFull: map[string]bool{},
9193
metrics: &OtelMetrics{
9294
ExportDrops: go_metrics.GetOrRegisterCounter("otel_export_drops", registry),
9395
},
@@ -232,7 +234,12 @@ func (f *OtelFormat) To(msgs []*kt.JCHF, serBuf []byte) (*kt.Output, error) {
232234
case ch <- m:
233235
default:
234236
f.metrics.ExportDrops.Inc(1)
235-
f.Warnf("OTEL channel full, dropping sample for metric=%s", m.Name)
237+
if !f.warnFull[m.Name] {
238+
f.Warnf("OTEL channel full, dropping sample for metric=%s", m.Name)
239+
f.warnFull[m.Name] = true
240+
} else {
241+
f.Debugf("OTEL channel full, dropping sample for metric=%s", m.Name)
242+
}
236243
}
237244
} else {
238245
ch <- m

0 commit comments

Comments
 (0)