-
Notifications
You must be signed in to change notification settings - Fork 646
Expand file tree
/
Copy pathREADME.md
More file actions
119 lines (87 loc) · 4.97 KB
/
README.md
File metadata and controls
119 lines (87 loc) · 4.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# OpenTelemetry Zipkin Exporter
![OpenTelemetry — An observability framework for cloud-native software.][splash]
[splash]: https://raw.githubusercontent.com/open-telemetry/opentelemetry-rust/main/assets/logo-text.png
[`Zipkin`] integration for applications instrumented with [`OpenTelemetry`].
[](https://crates.io/crates/opentelemetry-zipkin)
[](https://docs.rs/opentelemetry-zipkin)
[](./LICENSE)
[](https://github.com/open-telemetry/opentelemetry-rust/actions?query=workflow%3ACI+branch%3Amain)
[](https://cloud-native.slack.com/archives/C03GDP0H023)
## OpenTelemetry Overview
OpenTelemetry is an Observability framework and toolkit designed to create and
manage telemetry data such as traces, metrics, and logs. OpenTelemetry is
vendor- and tool-agnostic, meaning that it can be used with a broad variety of
Observability backends, including open source tools like [Jaeger] and
[Prometheus], as well as commercial offerings.
OpenTelemetry is *not* an observability backend like Jaeger, Prometheus, or other
commercial vendors. OpenTelemetry is focused on the generation, collection,
management, and export of telemetry. A major goal of OpenTelemetry is that you
can easily instrument your applications or systems, no matter their language,
infrastructure, or runtime environment. Crucially, the storage and visualization
of telemetry is intentionally left to other tools.
[`Zipkin`]: https://zipkin.io/
[`OpenTelemetry`]: https://crates.io/crates/opentelemetry
## Quickstart
First make sure you have a running version of the zipkin process you want to
send data to:
```shell
$ docker run -d -p 9411:9411 openzipkin/zipkin
```
Then install a new pipeline with the recommended defaults to start exporting
telemetry:
```rust
use opentelemetry::trace::Tracer;
use opentelemetry::global;
fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
global::set_text_map_propagator(opentelemetry_zipkin::Propagator::new());
let tracer = opentelemetry_zipkin::new_pipeline().install_simple()?;
tracer.in_span("doing_work", |cx| {
// Traced app logic here...
});
global::shutdown_tracer_provider();
Ok(())
}
```
## Performance
For optimal performance, a batch exporter is recommended as the simple exporter
will export each span synchronously on drop. You can enable the [`rt-tokio`],
[`rt-tokio-current-thread`] or [`rt-async-std`] features and specify a runtime
on the pipeline builder to have a batch exporter configured for you
automatically.
```toml
[dependencies]
opentelemetry = "*"
opentelemetry_sdk = { version = "*", features = ["rt-tokio"] }
opentelemetry-zipkin = { version = "*", features = ["reqwest-client"], default-features = false }
```
```rust
let tracer = opentelemetry_zipkin::new_pipeline()
.install_batch(opentelemetry_sdk::runtime::Tokio)?;
```
[`rt-tokio`]: https://tokio.rs
[`async-std`]: https://async.rs
## Choosing an HTTP client
The HTTP client that this exporter will use can be overridden using features or
a manual implementation of the [`HttpClient`] trait. By default the
`reqwest-blocking-client` feature is enabled which will use the `reqwest` crate.
While this is compatible with both async and non-async projects, it is not
optimal for high-performance async applications as it will block the executor
thread. Consider using the `reqwest-client` (without blocking) if you are in
the `tokio` ecosystem.
Note that async http clients may require a specific async runtime to be
available so be sure to match them appropriately.
[`HttpClient`]: https://docs.rs/opentelemetry/0.10/opentelemetry/exporter/trace/trait.HttpClient.html
## Kitchen Sink Full Configuration
[Example](https://docs.rs/opentelemetry-zipkin/latest/opentelemetry_zipkin/#kitchen-sink-full-configuration) showing how to override all configuration options. See the
[`ZipkinPipelineBuilder`] docs for details of each option.
[`ZipkinPipelineBuilder`]: https://docs.rs/opentelemetry-zipkin/latest/opentelemetry_zipkin/struct.ZipkinPipelineBuilder.html
## Supported Rust Versions
OpenTelemetry is built against the latest stable release. The minimum supported
version is 1.65. The current OpenTelemetry version is not guaranteed to build on
Rust versions earlier than the minimum supported version.
The current stable Rust compiler and the three most recent minor versions before
it will always be supported. For example, if the current stable compiler version
is 1.49, the minimum supported version will not be increased past 1.46, three
minor versions prior. Increasing the minimum supported compiler version is not
considered a semver breaking change as long as doing so complies with this
policy.