axum-otel
A structured logging middleware for Axum web framework that integrates with OpenTelemetry.
Features
- Structured logging middleware for Axum
- OpenTelemetry integration
- Request tracing
- Metrics collection
- Customizable span attributes
- OpenTelemetry HTTP semantic conventions for span attributes (see crate docs for migration from older field names)
Installation
Add this to your Cargo.toml:
[]
= "0.29.0"
= { = "0.8", = ["macros"] }
= { = "0.6.5", = ["trace"] }
= { = "0.29.0", = ["metrics"] }
= { = "0.29.0", = ["rt-tokio"] }
= { = "0.29.0", = ["metrics", "grpc-tonic"] }
Quick Start
use ;
use ;
use Config;
use ;
use SocketAddr;
use TraceLayer;
use Level;
async
async
Examples
Check out the examples directory for more usage examples:
Documentation
For more detailed documentation, visit docs.rs.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.