Skip to content

Revert "feat(sidekick): Inject InstrumentationClientInfo for tracing"#2435

Merged
westarle merged 1 commit intomainfrom
revert-2252-feat/rust-templates-client-info
Sep 29, 2025
Merged

Revert "feat(sidekick): Inject InstrumentationClientInfo for tracing"#2435
westarle merged 1 commit intomainfrom
revert-2252-feat/rust-templates-client-info

Conversation

@westarle
Copy link
Copy Markdown
Contributor

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.

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.00%. Comparing base (88698b4) to head (df0a204).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@westarle westarle marked this pull request as ready for review September 29, 2025 18:25
@westarle westarle requested a review from a team September 29, 2025 18:25
@westarle westarle merged commit c1a4ced into main Sep 29, 2025
10 of 11 checks passed
@westarle westarle deleted the revert-2252-feat/rust-templates-client-info branch September 29, 2025 19:07
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.
lqiu96 pushed a commit that referenced this pull request Sep 29, 2025
…#2435)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants