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.
What happened?
When using
opentelemetry-appender-tracingin conjunction withtracing-logto generate log records, the exported log records carry thetargetof the original log record. Thetracing-logcrate statically reports this (itsMetadata::target) as"log"for all of its events. However, under theexperimental_span_attributesfeature flag it looks like this was supposed to be uplifted fromlog.targetthroughNormalizeEvent- 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 thetarget.I've tried to reconstruct the relevant history to the best of my ability:
target.nameup to the top as well.log_recordfrom the normalized metadata, as even the severity text (that is not pre-computed) now refers back to the original metadata. Only the visitor for extracting thecode.now uses the normalized metadata.Independently of whether the
code.attributes are wanted, normalizing the event seems appropriate. While theNormalizeEventtrait seems to have been primarily introduced to allow printing the correct name intracing-fmt, the target / scope of the originallog::log!(orinfo!orerror!etc.) invocation is by definition more correct than justlog, 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
opentelemetrycrate)0.32.0
OpenTelemetry SDK Version (i.e version of
opentelemetry_sdkcrate)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
+1orme too, to help us triage it. Learn more here.