Commit ea54ba6
authored
feat(sidekick/rust): Update templates for otel (#2443)
- 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#32391 parent 6cb55d2 commit ea54ba6
File tree
2 files changed
+25
-1
lines changed- internal/sidekick/internal/rust/templates/crate/src
2 files changed
+25
-1
lines changedLines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
122 | 134 | | |
123 | 135 | | |
124 | 136 | | |
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
56 | 67 | | |
57 | 68 | | |
| 69 | + | |
58 | 70 | | |
59 | 71 | | |
60 | 72 | | |
| |||
167 | 179 | | |
168 | 180 | | |
169 | 181 | | |
170 | | - | |
| 182 | + | |
171 | 183 | | |
172 | 184 | | |
173 | 185 | | |
| |||
0 commit comments