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

Export level as custom span attribute #180

Closed
mTsBucy1 opened this issue Oct 29, 2024 · 2 comments
Closed

Export level as custom span attribute #180

mTsBucy1 opened this issue Oct 29, 2024 · 2 comments

Comments

@mTsBucy1
Copy link
Contributor

mTsBucy1 commented Oct 29, 2024

Feature Request

Motivation

I would like to use an opentelemetry backend to collect most of my traces. However, I would also like to be able to glance at them and only see important happenings. tracing has the nice concept of levels for this usecase, opentelemetry does not natively, but has custom fields.
This is in relation to the discussion #177.

Proposal

I propose to also attach the level of a tracing span to the opentelemetry span.
As far as I can entail, this would been adding an builder_attrs.push(KeyValue::new("level", attrs.metadata().level())); to Layer::on_new_span and possibliy adding a setting to enable this.
(this might be breaking, if it overrides custom "level" attributes).

I'm happy to make this change, but wanted to ask for feedback fist.

Alternatives

Alternatively, one could always attach an own field, but this entails a lot of duplication.

@djc
Copy link
Collaborator

djc commented Oct 29, 2024

I'm open to reviewing a PR for this.

djc pushed a commit that referenced this issue Nov 7, 2024
See #180 for a description.

This PR implements the `OpenTelemetryLayer::with_level` setting, to
disable (enabled by default) attaching the level tag to exported spans.
@mTsBucy1
Copy link
Contributor Author

Closed by #182

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

No branches or pull requests

2 participants