Skip to content

feat(sidekick/rust): Update templates for otel#2443

Merged
westarle merged 1 commit intogoogleapis:mainfrom
westarle:feat/otel-template-updates
Sep 30, 2025
Merged

feat(sidekick/rust): Update templates for otel#2443
westarle merged 1 commit intogoogleapis:mainfrom
westarle:feat/otel-template-updates

Conversation

@westarle
Copy link
Copy Markdown
Contributor

@westarle westarle commented Sep 30, 2025

  • Conditionally include INSTRUMENTATION_CLIENT_INFO static in lib.rs.mustache using lazy_static! based on the DetailedTracingAttributes flag.
  • Conditionally add .with_instrumentation() call in transport.rs.mustache based on the DetailedTracingAttributes flag.

Tested:

  1. Flag ON Test:

    • Reset showcase: git reset --hard HEAD && git clean -fdx in google-cloud-rust/src/generated/showcase
    • Regenerate: go run ./cmd/sidekick refresh -project-root ../google-cloud-rust -output src/generated/showcase -codec-option detailed-tracing-attributes=true in librarian
    • Format: cargo fmt -p google-cloud-showcase-v1beta1 in google-cloud-rust
    • Build & Test: cargo build -p google-cloud-showcase-v1beta1 && cargo test -p google-cloud-showcase-v1beta1 in google-cloud-rust - PASSED
  2. Flag OFF Test:

    • Reset showcase: git reset --hard HEAD && git clean -fdx in google-cloud-rust/src/generated/showcase
    • Modified google-cloud-rust/src/generated/showcase/.sidekick.toml to set detailed-tracing-attributes = false
    • Regenerate: go run ./cmd/sidekick refresh -project-root ../google-cloud-rust -output src/generated/showcase in librarian
    • Format: cargo fmt -p google-cloud-showcase-v1beta1 in google-cloud-rust
    • Diff: git diff in google-cloud-rust/src/generated/showcase - Showed no instrumentation code added, confirming the flag works.

For googleapis/google-cloud-rust#3239

- Conditionally include `INSTRUMENTATION_CLIENT_INFO` static in `lib.rs.mustache`
  using `lazy_static!` based on the `DetailedTracingAttributes` flag.
- Conditionally add `.with_instrumentation()` call in
  `transport.rs.mustache` based on the `DetailedTracingAttributes` flag.

Tested:
1.  **Flag ON Test:**
    - Reset showcase: `git reset --hard HEAD && git clean -fdx` in `google-cloud-rust/src/generated/showcase`
    - Regenerate: `go run ./cmd/sidekick refresh -project-root ../google-cloud-rust -output src/generated/showcase -codec-option detailed-tracing-attributes=true` in `librarian`
    - Format: `cargo fmt -p google-cloud-showcase-v1beta1` in `google-cloud-rust`
    - Build & Test: `cargo build -p google-cloud-showcase-v1beta1 && cargo test -p google-cloud-showcase-v1beta1` in `google-cloud-rust` - PASSED

2.  **Flag OFF Test:**
    - Reset showcase: `git reset --hard HEAD && git clean -fdx` in `google-cloud-rust/src/generated/showcase`
    - Modified `google-cloud-rust/src/generated/showcase/.sidekick.toml` to set `detailed-tracing-attributes = false`
    - Regenerate: `go run ./cmd/sidekick refresh -project-root ../google-cloud-rust -output src/generated/showcase` in `librarian`
    - Format: `cargo fmt -p google-cloud-showcase-v1beta1` in `google-cloud-rust`
    - Diff: `git diff` in `google-cloud-rust/src/generated/showcase` - Showed no instrumentation code added, confirming the flag works.
@codecov
Copy link
Copy Markdown

codecov bot commented Sep 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.01%. Comparing base (6cb55d2) to head (204fedb).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2443   +/-   ##
=======================================
  Coverage   85.01%   85.01%           
=======================================
  Files         100      100           
  Lines       10163    10163           
=======================================
  Hits         8640     8640           
  Misses       1183     1183           
  Partials      340      340           

☔ 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 30, 2025 15:38
@westarle westarle requested a review from a team September 30, 2025 15:38
@westarle westarle merged commit ea54ba6 into googleapis:main Sep 30, 2025
9 checks passed
westarle added a commit that referenced this pull request Oct 3, 2025
westarle added a commit to westarle/librarian that referenced this pull request Oct 3, 2025
Removes an unnecessary `&*` in the `with_instrumentation` call within the generated `transport.rs` file. This was causing a `clippy::explicit_auto_deref` warning.

This issue was highlighted in the google-cloud-rust CI after merging librarian PR googleapis#2443. See https://github.com/googleapis/google-cloud-rust/actions/runs/18226945878/job/51900522484?pr=3457

Tested:
  - Regenerated showcase with detailed-tracing-attributes=true, confirmed clippy passes.
  - Regenerated showcase with detailed-tracing-attributes=false, confirmed clippy passes and no tracing code was added.
westarle added a commit that referenced this pull request Oct 3, 2025
…ate (#2481)

Removes an unnecessary `&*` in the `with_instrumentation` call within
the generated `transport.rs` file. This was causing a
`clippy::explicit_auto_deref` warning.

This issue was highlighted in the google-cloud-rust CI after merging
librarian PR #2443. See
https://github.com/googleapis/google-cloud-rust/actions/runs/18226945878/job/51900522484?pr=3457

Tested:
- Regenerated showcase with detailed-tracing-attributes=true, confirmed
clippy passes.
- Regenerated showcase with detailed-tracing-attributes=false, confirmed
clippy passes and no tracing code was added.
suztomo pushed a commit that referenced this pull request Oct 13, 2025
Librarian Version: v0.0.0-20251009012716-e267b1dfc9b9
Language Image:
us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/librarian-release-container:latest
<details><summary>librarian: 0.4.0</summary>

##
[0.4.0](v0.3.0...v0.4.0)
(2025-10-09)

### Features

* add `git log` functionality (#2510)
([e267b1d](e267b1d))

* Modify README.md to match our agreed-upon wording (#2503)
([2dc6fc6](2dc6fc6))

* Show actual enum values on setter samples. (#2491)
([13fd5a1](13fd5a1))

* sort library state when writing to `state.yaml` (#2504)
([35e4495](35e4495))

* Generate methods that use server-side streaming (#2474)
([31a496d](31a496d))

* allow configuring tag_format in config.yaml (#2236)
([e0eeddb](e0eeddb))

* `update` supports different roots (#2473)
([65fa7ed](65fa7ed))

* Support git push via SSH (#2397)
([7259194](7259194))

* mount output dir in configure docker command (#2439)
([365019e](365019e))

* Update templates for otel (#2443)
([ea54ba6](ea54ba6))

* support aggregated pagination (#2432)
([5b010b9](5b010b9))

* override pagination items field (#2441)
([4a3664a](4a3664a))

* include source root in configure request (#2431)
([475a62d](475a62d))

* rust&#43;disco bytes (de)serialization (#2428)
([b2a186c](b2a186c))

* enum serialization for non-proto sources (#2410)
([516f29e](516f29e))

* optional singular fields in discovery (#2408)
([c86c2db](c86c2db))

* deprecated elements in discovery docs (#2399)
([1d83853](1d83853))

* allow &#34;.&#34; as valid `source_roots` entry (#2396)
([2f52aa7](2f52aa7))

* inline messages in discovery docs (#2394)
([043cf65](043cf65))

* write pr-body.txt to the work root when not pushing (#2395)
([862c7d7](862c7d7))

* define LIBRARIAN_GITHUB_TOKEN as a constant (#2367)
([5979bfd](5979bfd))

### Bug Fixes

* clarify doc and comment with commit and push flag (#2507)
([645e42a](645e42a))

* keep first value for repeated footer keys (#2440)
([e51490d](e51490d))

* group commit msg if they have the same piper id and subject (#2496)
([60b7d38](60b7d38))

* real runs for `rust-publish` (#2484)
([15d63c2](15d63c2))

* Remove unnecessary dereference in transport template (#2481)
([610cec9](610cec9))

* shorten SHAs in generate commit msgs (#2472)
([de336b1](de336b1))

* handle slashes in library IDs (#2463)
([91c0189](91c0189))

* nil check for github.NewClient (#2465)
([71db17e](71db17e))

* Conventional Commit parser filters files based on Librarian flow
(#2433)
([6cb55d2](6cb55d2))

* Ensure detailed-tracing-attributes flag is fully propagated (#2438)
([a184f0d](a184f0d))

* relax footer regex to allow line broke footers to be properly
recognized (#2388)
([dcbe063](dcbe063))

* release init provides read-only full repository (#2370)
([2e11004](2e11004))

* write the PR body on &#34;commit but no push&#34; (#2430)
([88698b4](88698b4))

* should not push to github when no push flag specified (#2405)
([2a49ae6](2a49ae6))

* only mount global files in configure command (#2377)
([1a2aaa0](1a2aaa0))

* `Map` field attribute in discovery (#2414)
([00c645f](00c645f))

* missing IDs in discovery doc fields (#2386)
([d579dd7](d579dd7))

</details>
zhumin8 pushed a commit to zhumin8/librarian that referenced this pull request Nov 17, 2025
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