WIP - feat(o11y): use local crate name as tracing target#5197
Draft
haphungw wants to merge 1 commit intogoogleapis:mainfrom
Draft
WIP - feat(o11y): use local crate name as tracing target#5197haphungw wants to merge 1 commit intogoogleapis:mainfrom
haphungw wants to merge 1 commit intogoogleapis:mainfrom
Conversation
829e019 to
eedbb03
Compare
coryan
reviewed
Mar 30, 2026
Comment on lines
+42
to
+48
| let inner_future = $inner; | ||
| async move { | ||
| let output = inner_future.await; | ||
| if let Some(snapshot) = | ||
| $crate::observability::RequestRecorder::current().map(|r| r.client_snapshot()) | ||
| { | ||
| if let Err(error) = &output { |
Collaborator
There was a problem hiding this comment.
Consider:
Suggested change
| let inner_future = $inner; | |
| async move { | |
| let output = inner_future.await; | |
| if let Some(snapshot) = | |
| $crate::observability::RequestRecorder::current().map(|r| r.client_snapshot()) | |
| { | |
| if let Err(error) = &output { | |
| async move { | |
| $inner.await.inspect_err(|error| { | |
| let Some(snapshot) = | |
| $crate::observability::RequestRecorder::current().map(|r| r.client_snapshot()) else { return; } | |
| ... ... | |
| ::tracing::event!( | |
| name: "experimental.client.request.error", | |
| target: env!("CARGO_PKG_NAME"), | |
| ::tracing::Level::WARN, | |
| // Use literals because we don't want to re-export the constants. | |
| "rpc.system.name" = snapshot.rpc_system(), | |
| ... ... ... | |
| ); | |
| }) | |
| } |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5197 +/- ##
=======================================
Coverage 98.01% 98.01%
=======================================
Files 214 214
Lines 44110 44110
=======================================
Hits 43236 43236
Misses 874 874 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4e28cd5 to
eedbb03
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor the
WithClientLoggingcomponent to dynamically assign thetracing::event!targetfield to the name of the crate emitting the log (e.g.,google-cloud-storage).To implement log separation per-client, we converted
WithClientLoggingfrom a generic struct wrapping aFutureinto a#[macro_export]. Whenclient_request_signals!holds a pending HTTP future inside a generated client crate, it expands the new macro locally.env!("CARGO_PKG_NAME")locks onto that caller crate's name, injecting it into thetracingtarget literal at compile time.Fixes #5150