Skip to content

Commit

Permalink
Use a unique target for request spans (#615)
Browse files Browse the repository at this point in the history
These spans are emitted at a high level (WARN), which is annoying for
clients that want to use an adapter to the `log` facade, where `tracing`
will emit an event whenever a span is created. To help these clients
filter out these span events, let's use a unique target for them.

I verified that log messages for requests are still emitting this span
metadata when Mountpoint requests log, so this only affects clients that
aren't using `tracing`.

Signed-off-by: James Bornholt <[email protected]>
  • Loading branch information
jamesbornholt authored Nov 21, 2023
1 parent 661d0fb commit 3d9b8a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mountpoint-s3-client/src/s3_crt_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ macro_rules! request_span {
// I have confused myself at least 4 times about how to choose the level for tracing spans.
// We want this span to be constructed whenever events at WARN or lower severity (INFO,
// DEBUG, TRACE) are emitted. So we set its severity to WARN too.
let span = tracing::warn_span!($method, id = counter, $($field)*);
let span = tracing::warn_span!(target: "mountpoint_s3_client::s3_crt_client::request", $method, id = counter, $($field)*);
span.in_scope(|| tracing::debug!("new request"));
span
}};
Expand Down

0 comments on commit 3d9b8a9

Please sign in to comment.