Skip to content

Add level metadata to spans#182

Merged
djc merged 2 commits into
tokio-rs:v0.1.xfrom
mTsBucy1:v0.1.x
Nov 7, 2024
Merged

Add level metadata to spans#182
djc merged 2 commits into
tokio-rs:v0.1.xfrom
mTsBucy1:v0.1.x

Conversation

@mTsBucy1

Copy link
Copy Markdown
Contributor

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.

There are several concerns I see before recommending merging this:

  • Will enable by default break code which manually set the level field? If so, disable-by-default seems smarter.
  • Event levels are still always exported, should we also restrict this?
  • I am somewhat confused, but it seems error level events set the span status to error. Is this behaviour intuitive, once we have a level attached to the span? Should error spans always set the span status?

@djc

djc commented Nov 5, 2024

Copy link
Copy Markdown
Collaborator

@mladedav any opinions on this? I don't have a strong opinion.

@mladedav

mladedav commented Nov 5, 2024

Copy link
Copy Markdown
Collaborator

Looks good to me and I think this will be useful.

This should just also include a changelog entry for anyone who sets some kind of level explicitly as a span field.

@djc djc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@mladedav thanks for the quick followup!

Comment thread src/layer.rs Outdated
@djc
djc merged commit 95f9ab9 into tokio-rs:v0.1.x Nov 7, 2024
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.

3 participants