Expand description
Zipkin tracer implementation for OpenTracingRust
See the examples for usage.
§Official API heads up
An Opentracing official API is in the works: https://github.com/opentracing/opentracing-rust
Once the official API crate is finished I hope to re-implement this crate to be based off of that API rather then my own implementation of a base crate.
For that reason, development of this crate will be limited while I dedicate my time to the development of the offical opentracing-api crate.
Lessons learend while developing this crate will be valuable knowledge for opentracing-api. If you find any issue and or usability limit, please let me know!
§Example
ⓘ
extern crate opentracingrust;
extern crate opentracingrust_zipkin;
use opentracingrust::utils::ReporterThread;
use opentracingrust_zipkin::KafkaCollector;
use opentracingrust_zipkin::ZipkinEndpoint;
use opentracingrust_zipkin::ZipkinTracer;
fn main() {
// Create the tracer.
let (tracer, receiver) = ZipkinTracer::new();
// Create a zipkin collector (to send finished spans to zipkin).
let mut collector = KafkaCollector::new(
ZipkinEndpoint::new(None, None, Some(String::from("some-service")), None),
String::from("zipkin"), vec![String::from("127.0.0.1:9092")]
);
// Create a reporter thread to process finished spans.
let mut reporter = ReporterThread::new(receiver, move |span| {
match collector.collect(span) {
Err(err) => println!("Failed to report span: {:?}", err),
_ => (),
}
});
// Your program goes here
// ... snip ...
}
Structs§
- Http
Collector - Submit finished spans to Zipkin over HTTP.
- Http
Collector Opts - HTTP collector options.
- Zipkin
Endpoint - Indicates the network context of a service recording an annotation with two exceptions.
- Zipkin
Tracer - A Zipkin backed OpenTracingRust tracer.
Enums§
- Error
- Enumeration of all errors returned by the crate.
Type Aliases§
- Result
- Type alias for
Result
s that can fail with anError
.