Skip to content

Commit

Permalink
attributes: Improve output for #[instrument(ret)]
Browse files Browse the repository at this point in the history
This ensures that events generated by this instrumentation have a useful
name for consumption in common OpenTelemetry tracing tools.
  • Loading branch information
notheotherben committed Sep 20, 2022
1 parent 3b58df3 commit 6c90c68
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tracing-attributes/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,13 @@ fn gen_block<B: ToTokens>(

let ret_event = match args.ret_mode {
Some(FormatMode::Display) => Some(quote!(
tracing::event!(target: #target, #level, return = %x)
tracing::event!(target: #target, #level, { return = %x }, "{}", x)
)),
Some(FormatMode::Default) | Some(FormatMode::Debug) => Some(quote!(
tracing::event!(target: #target, #level, return = ?x)
tracing::event!(target: #target, #level, { return = ?x }, "{}", x)
)),
Some(FormatMode::Raw) => Some(quote!(
tracing::event!(target: #target, #level, return = x)
tracing::event!(target: #target, #level, { return = x }, "{}", x)
)),
_ => None,
};
Expand Down

0 comments on commit 6c90c68

Please sign in to comment.