Skip to content

Commit a3c4a5b

Browse files
committed
feat(o11y): add record_polling_attributes macro
1 parent 1059b90 commit a3c4a5b

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/lro/src/internal/tracing.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,21 @@ impl LroRecorder {
9898
}
9999
}
100100

101+
/// Injects LRO-specific telemetry attributes into the active span.
102+
#[macro_export]
103+
#[doc(hidden)]
104+
macro_rules! record_polling_attributes {
105+
($span:expr) => {
106+
#[cfg(google_cloud_unstable_tracing)]
107+
{
108+
if let Ok(attempt) = $crate::POLL_ATTEMPT_COUNT.try_with(|c| *c) {
109+
$span.record("gcp.longrunning.poll_attempt_count", attempt);
110+
$span.record("gcp.longrunning.done", false);
111+
}
112+
}
113+
};
114+
}
115+
101116
/// Decorate a poller with tracing information.
102117
#[derive(Clone, Debug)]
103118
pub struct Tracing<P> {

0 commit comments

Comments
 (0)