Skip to content

[Bug]: Appender-tracing creates log records with the wrong metadata under experimental_span_attributes feature #3543

Description

@dquirl-R1

What happened?

When using opentelemetry-appender-tracing in conjunction with tracing-log to generate log records, the exported log records carry the target of the original log record. The tracing-log crate statically reports this (its Metadata::target) as "log" for all of its events. However, under the experimental_span_attributes feature flag it looks like this was supposed to be uplifted from log.target through NormalizeEvent - yet it isn't, because the target is evaluated first. This leads to the instrumentation scope name also being wrong, as that is filled in from the target.

I've tried to reconstruct the relevant history to the best of my ability:

Independently of whether the code. attributes are wanted, normalizing the event seems appropriate. While the NormalizeEvent trait seems to have been primarily introduced to allow printing the correct name in tracing-fmt, the target / scope of the original log::log! (or info! or error! etc.) invocation is by definition more correct than just log, as it reports the actual location of the log event in the originating crate. I'm not sure if it needs to be tied to the same feature flag as the experimental attributes, which are uplifted through the dedicated visitor, but at the very least when the event metadata is normalized I'd expect the resulting target to be post-norm.

OpenTelemetry API Version (i.e version of opentelemetry crate)

0.32.0

OpenTelemetry SDK Version (i.e version of opentelemetry_sdk crate)

0.32.0

What Exporter(s) are you seeing the problem on?

OTLP

Relevant log output

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-logArea: Issues related to logsbugSomething isn't workingpriority:p3Lowest priority issues and bugs.triage:acceptedHas been triaged and accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions