#[instrument(fields(tags.host = %account.host))]
async fn sync(account: Account) {
tracing::error!("account sync failed");
}
This code, when called, produces a span with a host tag, and an error without one. I would like the host tag to apply to the error too.
I.e. instrument(fields()) should be equivalent to sentry::set_tag, rather than current_span.set_tag.
The main reason is that I find it irritating to have instrumentation apply to all of my spans, but not on the errors, where it's most important.
My current workaround is to add tags to the error explicitly:
#[instrument(fields(tags.host = %account.host))]
async fn sync(account: Account) {
tracing::error!("account sync failed", tags.host = %account.host);
}
Solution Brainstorm
Internally, I'm not sure if that means a new scope needs to be pushed for each span, or something like that.
This code, when called, produces a span with a
hosttag, and an error without one. I would like thehosttag to apply to the error too.I.e.
instrument(fields())should be equivalent tosentry::set_tag, rather thancurrent_span.set_tag.The main reason is that I find it irritating to have instrumentation apply to all of my spans, but not on the errors, where it's most important.
My current workaround is to add tags to the error explicitly:
Solution Brainstorm
Internally, I'm not sure if that means a new scope needs to be pushed for each span, or something like that.