Expand description
§otlp-embedded
A simple in-memory implementation of the OpenTelemetry trace collector with a Web UI for visualizing the traces that can be embedded into other Rust applications.
§Example
ⓘ
use otlp_embedded::{ui_app, State, TraceServiceImpl, TraceServiceServer};
#[tokio::main]
async fn main() {
let state = State::new(Config {
max_length: 100,
max_memory_usage: 1 << 27, // 128 MiB
});
let state_clone = state.clone();
tokio::spawn(async {
axum::Server::bind(&"0.0.0.0:10188".parse().unwrap())
.serve(ui_app(state, "/").into_make_service())
.await
.unwrap();
});
tonic::transport::Server::builder()
.add_service(TraceServiceServer::new(TraceServiceImpl::new(state_clone)))
.serve("0.0.0.0:43177".parse().unwrap())
.await
.unwrap();
}Modules§
- proto
- The generated protobuf and gRPC code for OpenTelemetry trace service.
Structs§
- Config
- Configuration for the
State. - State
- In-memory state that maintains the most recent traces.
- Trace
- A trace that consists of multiple spans in a tree structure.
- Trace
Service Impl - The implementation of
TraceService. - Trace
Service Server - Service that can be used to push spans between one Application instrumented with OpenTelemetry and a collector, or between a collector and a central collector (in this case spans are sent/received to/from multiple Applications).
Traits§
- Trace
Service - Generated trait containing gRPC methods that should be implemented for use with TraceServiceServer.
Functions§
- ui_app
- Create a new
axum::Routerfor the Jaeger UI to visualize the traces stored in the givenStateRef.