Skip to content

Spread log.attributes after log.resource?.attributes #12371

@jerop

Description

@jerop

According to OpenTelemetry conventions, when the same attribute key exists on both a LogRecord and its associated Resource, the LogRecord's attribute value should take precedence as it provides more specific context. The current implementation spreads log.resource?.attributes after log.attributes, which means resource attributes would overwrite log attributes in case of a key collision. To adhere to the convention and prevent potential loss of specific log information, the order of spreading should be reversed.

            ...log.resource?.attributes,
            ...log.attributes,

Originally posted by @gemini-code-assist[bot] in #12370

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions