Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tracing Appender] Propagate event name to exporters #1346

Merged
merged 4 commits into from
Nov 10, 2023

Conversation

lalitb
Copy link
Member

@lalitb lalitb commented Nov 7, 2023

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

error!(name: "my-event-name", event_id = 20, user_name = "otel", user_email = "otel@opentelemetry.io");

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.

@lalitb lalitb requested a review from a team November 7, 2023 02:23
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Attention: 13 lines in your changes are missing coverage. Please review.

Files Coverage Δ
opentelemetry-appender-tracing/src/layer.rs 0.0% <0.0%> (ø)
...pentelemetry-user-events-logs/src/logs/exporter.rs 0.0% <0.0%> (ø)

📢 Thoughts on this report? Let us know!

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add changelogs too!

@cijothomas cijothomas merged commit a74ecd1 into open-telemetry:main Nov 10, 2023
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants