1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! Future instrumentation utilities for tracing async operations.
//!
//! This module provides utilities for instrumenting Rust futures with telemetry spans.
//! When a future is instrumented, the associated span is automatically entered every time
//! the future is polled.
//!
//! # Examples
//!
//! ```rust
//! use veecle_telemetry::future::FutureExt;
//! use veecle_telemetry::span;
//!
//! async fn example() {
//! let span = span!("async_operation", user_id = 123);
//!
//! some_async_work().with_span(span).await;
//! }
//!
//! async fn some_async_work() {
//! // This work will be traced under the "async_operation" span
//! }
//! ```
use Future;
use Pin;
use ;
use crateSpan;
/// Extension trait for instrumenting futures with telemetry spans.
///
/// This trait provides methods to attach telemetry spans to futures,
/// ensuring that the spans are entered every time the future is polled.
/// A future that has been instrumented with a telemetry span.
///
/// This future wrapper ensures that the associated span is entered every time
/// the future is polled.
///
/// Instances of this type are created using the [`FutureExt::with_span`] method.