[Tracing Appender] Propagate event name to exporters #1346
Merged
+21
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As per the recent changes in Tokio Tracing library - tokio-rs/tracing#2699, it now allows setting event name in tracing macros. E.g., in
As lots of backends support event/log name (ElasticSearch, Fluentd, Sentry etc), it should be possible for users to specify event name using tracing macros, and export them to these backend through custom otel-exporters.
The PR modifies tracing subscriber to propagates this event-name to exporters by adding it to attributes. And if the attributes already have the key with the same name, that would override the "name" metadata field. Also, modified user_events log exporter to utilize this field. As of now, user_events exporter expect user to provide this field as "event_name" attribute through tracing macros.
TBD - It is also good to have parity across the metadata field in tracing event, and the log-record, at-least log-record structure should optionally have the additive field from the event metadata (and
name
is one such field). I plan to subsequently propose adding this field in LogRecord implementation separately.