Skip to content

sdk/log: Bad log message when key-value paris are dropped because of key duplication #6983

@pellared

Description

@pellared

Currently, when the key-values are discarded because of key duplication

attrs, drop = dedup(attrs)
r.setDropped(drop)

attrs, drop = dedup(attrs)
r.setDropped(drop)

kvs, dropped := dedup(val.AsMap())
r.addDropped(dropped)

then limit reached: dropping log Record attributes log is being emitted which is inaccurate; e.g.

func (r *Record) setDropped(n int) {
logAttrDropped()
r.dropped = n
}

Instead we should log something like key duplication: dropping key-value pair instead.

Moreover Record.DroppedAttributes is also adding the count if dropped key-value pairs during deduplication.

// DroppedAttributes returns the number of attributes dropped due to limits
// being reached.
func (r *Record) DroppedAttributes() int {
return r.dropped
}

I think we do not need to count the dropped duplicates as this is an error scenario and it would be enough to just log ones when it happens.

Metadata

Metadata

Assignees

Labels

area:logsPart of OpenTelemetry logsbugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is neededpkg:SDKRelated to an SDK package

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions