You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-29 23:07:45 +02:00
Log warning when a trace attribute/event/link is discarded due to limits (#5434)
Fix #5343 - Update the `evictionQueue` to log when it drops a value - Update the `evictionQueue` to be declared over an `[T any]` parameter so it knows what to log when it is dropping a value and to reduce the `interface{}` allocation - Add a `clone` method to replace the now unneeded `interfaceArrayTo*Array` functions. - Update the `recordingSpan` to log once that is dropped an attribute when limits are reached.
This commit is contained in:
@@ -234,6 +234,22 @@ func TestTruncateAttr(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLogDropAttrs(t *testing.T) {
|
||||
orig := logDropAttrs
|
||||
t.Cleanup(func() { logDropAttrs = orig })
|
||||
|
||||
var called bool
|
||||
logDropAttrs = func() { called = true }
|
||||
|
||||
s := &recordingSpan{}
|
||||
s.addDroppedAttr(1)
|
||||
assert.True(t, called, "logDropAttrs not called")
|
||||
|
||||
called = false
|
||||
s.addDroppedAttr(1)
|
||||
assert.False(t, called, "logDropAttrs called multiple times for same Span")
|
||||
}
|
||||
|
||||
func BenchmarkRecordingSpanSetAttributes(b *testing.B) {
|
||||
var attrs []attribute.KeyValue
|
||||
for i := 0; i < 100; i++ {
|
||||
|
||||
Reference in New Issue
Block a user