Rust tracing example
Please update authorization
, organization
, and stream-name
information in below function in main.rs, you can find this information by navigating OpenObserve UI to ingestion -> custom -> traces -> OTEL Collector.
fn otl_metadata() -> Result<MetadataMap, Error> {
let mut map = MetadataMap::with_capacity(3);
map.insert(
"authorization",
format!("Basic cm9vdEBleGFtcGxlLmNvbTprVUZ2SmpDYjRibjZMcUZo") // This is picked from the Ingestion tab OpenObserve
.parse()
.unwrap(),
);
map.insert("organization", "default".parse().unwrap());
map.insert("stream-name", "default".parse().unwrap());
Ok(map)
}
This sample program uses opentelemetry_otlp via grpc.
cargo run
The trace should be collected by OpenObserve and searchable as shown below