getsentry / sentry-rust

Official Sentry SDK for Rust
https://sentry.io/
Apache License 2.0
620 stars 153 forks source link

tracing: Propagate span to tags #634

Open frjonsen opened 10 months ago

frjonsen commented 10 months ago

This is related to what was solved in this PR: https://github.com/getsentry/sentry-rust/pull/629

Currently all spans are propagated to context. I feel what's missing is that spans named "tags" should instead be propagated to tags in Sentry.

At a glance it should be sufficient to add a check in the arms of this match https://github.com/getsentry/sentry-rust/blob/acba14fb89638749a2b662223946498f92c4008c/sentry-tracing/src/converters.rs#L71-L88 where if the span name is tags, then the key should be formatted as tags.{}, rather than the current {}.{}.

Swatinem commented 10 months ago

TBH, this feels a bit too magical, and might lead to some surprises as well.

Especially if you happen to have such a function:

#[tracing::instrument]
fn tags(arg: ()) {
}

This is an interesting idea though, and may be something to put more thought into.