-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
"Deduplication" of the key-values is part of the specification and it also involves Body
of the log record.
Body
is of any
type (https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#field-body).
any
can have a map<string, any>
(https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#type-any).
map<string, any>
does not allow duplicated keys (https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#type-mapstring-any).
Currently, we're not de-duplicating key-value collections within the log record body.
opentelemetry-go/sdk/log/record.go
Lines 168 to 171 in afd4763
// SetBody sets the body of the log record. | |
func (r *Record) SetBody(v log.Value) { | |
r.body = v | |
} |
Here is what we should add
opentelemetry-go/sdk/log/record.go
Lines 428 to 432 in afd4763
case log.KindMap: | |
// Deduplicate then truncate. Do not do at the same time to avoid | |
// wasted truncation operations. | |
kvs, dropped := dedup(val.AsMap()) | |
r.addDropped(dropped) |
It is important to do it recursively and also make sure that the attribute limits are NOT applied; see: open-telemetry/opentelemetry-specification#4006.
Originally posted by @pellared in #6968 (comment)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status