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: Propagate span to tags #634

Open
frjonsen opened this issue Jan 11, 2024 · 1 comment
Open

tracing: Propagate span to tags #634

frjonsen opened this issue Jan 11, 2024 · 1 comment

Comments

@frjonsen
Copy link

This is related to what was solved in this PR: #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

match &span_data.sentry_span {
TransactionOrSpan::Span(span) => {
for (key, value) in span.data().iter() {
if key != "message" {
let key = format!("{}:{}", name, key);
visitor.json_values.insert(key, value.clone());
}
}
}
TransactionOrSpan::Transaction(transaction) => {
for (key, value) in transaction.data().iter() {
if key != "message" {
let key = format!("{}:{}", name, key);
visitor.json_values.insert(key, value.clone());
}
}
}
}
where if the span name is tags, then the key should be formatted as tags.{}, rather than the current {}.{}.

@Swatinem
Copy link
Member

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.

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