Skip to content

Commit 0d318a9

Browse files
authored
feat(sidekick/rust): use consolidated LroRecorder in tracing decorator (#6259)
Update the template to generate code using our new consolidated `LroRecorder` API (googleapis/google-cloud-rust#5803). Instead of querying the separated `POLL_ATTEMPT_COUNT` task-local directly, the telemetry stubs will now query the active recorder. Staged @ googleapis/google-cloud-rust#5804 Follow up 2 for googleapis/google-cloud-rust#5695
1 parent 9762b43 commit 0d318a9

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

internal/sidekick/rust/templates/crate/src/tracing.rs.mustache

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ where T: super::stub::{{Codec.Name}} + std::fmt::Debug + Send + Sync {
8383
{{#Codec.IsLroPoller}}
8484
#[cfg(google_cloud_unstable_tracing)]
8585
{
86-
if let Ok(attempt) = google_cloud_lro::POLL_ATTEMPT_COUNT.try_with(|c| *c) {
87-
_span.record("gcp.longrunning.poll_attempt_count", attempt);
86+
if let Some(recorder) = google_cloud_lro::LroRecorder::current() {
87+
if let Some(attempt) = recorder.attempt_count() {
88+
_span.record("gcp.longrunning.poll_attempt_count", attempt);
89+
}
8890
_span.record("gcp.longrunning.done", false);
8991
}
9092
}
@@ -93,7 +95,7 @@ where T: super::stub::{{Codec.Name}} + std::fmt::Debug + Send + Sync {
9395
let result = pending.await;
9496
#[cfg(google_cloud_unstable_tracing)]
9597
{
96-
if google_cloud_lro::POLL_ATTEMPT_COUNT.try_with(|c| *c).is_ok() {
98+
if google_cloud_lro::LroRecorder::current().is_some() {
9799
match &result {
98100
Ok(response) => {
99101
let op = response.body();

0 commit comments

Comments
 (0)