Revert "feat(sidekick): Inject InstrumentationClientInfo for tracing"#2435
Merged
Revert "feat(sidekick): Inject InstrumentationClientInfo for tracing"#2435
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2435 +/- ##
==========================================
+ Coverage 84.89% 85.00% +0.11%
==========================================
Files 100 100
Lines 10144 10200 +56
==========================================
+ Hits 8612 8671 +59
+ Misses 1189 1188 -1
+ Partials 343 341 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dbolduc
approved these changes
Sep 29, 2025
westarle
added a commit
that referenced
this pull request
Sep 29, 2025
…propagated (#2438) This commit fixes the propagation of the `detailed-tracing-attributes` flag to all necessary annotation structs and updates the templates to correctly utilize the flag. See #2435 and #2252 For googleapis/google-cloud-rust#3239 Specifically: - Adds `DetailedTracingAttributes` field to `modelAnnotations` and `serviceAnnotations` in `annotate.go` to make the flag accessible in `lib.rs.mustache` and service-level sections of `transport.rs.mustache`. - Updates `annotateModel` and `annotateService` to populate the new fields. - Adds comprehensive unit tests in `annotate_test.go` to verify the `DetailedTracingAttributes` flag is correctly set across `modelAnnotations`, `serviceAnnotations`, `methodAnnotation`, and `pathBindingAnnotation` based on the codec options. - Modifies `lib.rs.mustache` to initialize the static `INSTRUMENTATION_CLIENT_INFO` using `std::sync::LazyLock` to accommodate the non-const `default()` function. - Updates `transport.rs.mustache` to correctly dereference the `LazyLock` when calling `with_instrumentation` (i.e., `&*crate::info::INSTRUMENTATION_CLIENT_INFO`). These changes ensure that the conditional code blocks in both `lib.rs.mustache` and `transport.rs.mustache` related to detailed tracing are generated correctly based on the `detailed-tracing-attributes` flag. Tested: - Ran `go test -race ./...` in the librarian repository to ensure all unit tests pass, including new tests for flag propagation in annotations. - Manually regenerated the `google-cloud-showcase-v1beta1` client in a local `google-cloud-rust` clone using the modified librarian: 1. With `--codec-option=detailed-tracing-attributes=true`: - Verified `src/generated/showcase/src/lib.rs` contains the `INSTRUMENTATION_CLIENT_INFO` static (using `LazyLock`). - Verified `src/generated/showcase/src/transport.rs` includes `.with_instrumentation(&*crate::info::INSTRUMENTATION_CLIENT_INFO)` calls within the `if tracing_is_enabled` blocks in the `new` methods. - Confirmed the crate builds and tests pass: `cargo build -p google-cloud-showcase-v1beta1` `cargo test -p google-cloud-showcase-v1beta1` 2. With the flag off (default): - Verified the above tracing-specific code is absent. 3. By setting `detailed-tracing-attributes = "true"` in `src/generated/showcase/.sidekick.toml` and running refresh without the codec option, confirming the config file is also respected.
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.
Reverts #2252
My automated testing was wrong, it was happily disabled in both the lib.rs and transport.rs because the feature flag wasn't propagated. I have prepared a fix for the generator, but I'm finding this code incorrect and so I'd like to revert if it can be done cleanly.