otex
Macros and minimal wrappers over the OpenTelemetry API for Rust.
Overview
otex provides convenient macros and utilities to simplify working with OpenTelemetry in Rust applications. It handles the initialization of tracing, logging, and metrics providers while offering ergonomic macros for creating spans, events, and logs.
Usage
Initialization
use init;
let otex = init; // Use default logging, or pass Some(custom_logger)
// Your application code here...
otex.shutdown; // Clean shutdown of all providers
Tracing
use ;
// Create a span
let _span = span!;
// Add events
event!;
Logging
use log;
use Severity;
log!;
Key-Value Helpers
use kvset;
let attributes = kvset!;
Features
- stdout: Enable stdout exporters for development/debugging
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.