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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//! # `veecle-telemetry`
//!
//! A telemetry library for collecting and exporting observability data including traces, logs, and metrics.
//!
//! This crate provides telemetry collection capabilities with support for both `std` and `no_std`
//! environments, including FreeRTOS targets.
//!
//! ## Features
//!
//! - **Tracing**: Distributed tracing with spans, events, and context propagation
//! - **Logging**: Structured logging with multiple severity levels
//! - **Zero-cost abstractions**: When telemetry is disabled, operations compile to no-ops
//! - **Cross-platform**: Works on `std`, `no_std`, and FreeRTOS environments
//! - **Exporters**: Multiple export formats including JSON console output
//!
//! ## Feature Flags
//!
//! - `enable` - Enable collecting and exporting telemetry data, should only be set in binary crates
//! - `std` - Enable standard library support
//! - `alloc` - Enable allocator support for dynamic data structures
//! - `freertos` - Enable FreeRTOS support
//! - `system_time` - Enable system time synchronization
//!
//! ## Basic Usage
//!
//! First, set up an exporter in your application:
//!
//! ```rust
//! use veecle_telemetry::collector::{ConsoleJsonExporter, set_exporter};
//! use veecle_telemetry::protocol::ExecutionId;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let execution_id = ExecutionId::random(&mut rand::rng());
//! set_exporter(execution_id, &ConsoleJsonExporter)?;
//! # Ok(())
//! # }
//! ```
//!
//! Then use the telemetry macros and functions:
//!
//! ```rust
//! use veecle_telemetry::{Span, info, instrument, span};
//!
//! // Structured logging
//! info!("Server started", port = 8080, version = "1.0.0");
//!
//! // Manual span creation
//! let span = span!("process_request", user_id = 123);
//! let _guard = span.entered();
//!
//! // Automatic instrumentation
//! #[instrument]
//! fn process_data(input: &str) -> String {
//! // Function body is automatically wrapped in a span
//! format!("processed: {}", input)
//! }
//! ```
//!
//! ## Span Management
//!
//! Spans represent units of work and can be nested to show relationships:
//!
//! ```rust
//! use veecle_telemetry::{CurrentSpan, span};
//!
//! let parent_span = span!("parent_operation");
//! let _guard = parent_span.entered();
//!
//! // Child spans automatically inherit the parent context
//! let child_span = span!("child_operation", step = 1);
//! let _child_guard = child_span.entered();
//!
//! // Add events to the current span
//! CurrentSpan::add_event("milestone_reached", &[]);
//! ```
//!
//! ## Conditional Compilation
//!
//! When the `enable` feature is disabled, all telemetry operations compile to no-ops,
//! ensuring zero runtime overhead in production builds where telemetry is not needed.
extern crate std;
extern crate alloc;
compile_error!
pub use ;
pub use ;
pub use ;
pub use instrument;