1 unstable release
Uses new Rust 2024
| 0.1.0 | Sep 16, 2025 |
|---|
#227 in Science
190 downloads per month
Used in 4 crates
130KB
2K
SLoC
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 cratesstd- Enable standard library supportalloc- Enable allocator support for dynamic data structuresfreertos- Enable FreeRTOS supportsystem_time- Enable system time synchronization
Basic Usage
First, set up an exporter in your application:
use veecle_telemetry::collector::{ConsoleJsonExporter, set_exporter};
use veecle_telemetry::protocol::ExecutionId;
let execution_id = ExecutionId::random(&mut rand::rng());
set_exporter(execution_id, &ConsoleJsonExporter)?;
Then use the telemetry macros and functions:
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:
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.
veecle-telemetry
Veecle OS telemetry.
Overview
This crate provides telemetry collection and export capabilities for Veecle OS applications.
It supports distributed tracing, structured logging, and metrics collection with support for both std and no_std environments.
Note: Most users should depend on the veecle-os crate instead of using this crate directly.
The veecle-os crate re-exports this functionality and provides a more complete API for building Veecle OS applications.
For examples and more detailed usage information, please refer to the repository.
Features
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.
Dependencies
~0.7–13MB
~106K SLoC