@@ -15,4 +15,126 @@ This crate contains the [OpenTelemetry](https://opentelemetry.io/) API for Rust.
15
15
16
16
## Overview
17
17
18
+ ## Overview
19
+
20
+ OpenTelemetry is an Observability framework and toolkit designed to create and
21
+ manage telemetry data such as traces, metrics, and logs. OpenTelemetry is
22
+ vendor- and tool-agnostic, meaning that it can be used with a broad variety of
23
+ Observability backends, including open source tools like [ Jaeger] and
24
+ [ Prometheus] , as well as commercial offerings.
25
+
26
+ OpenTelemetry is * not* an observability backend like Jaeger, Prometheus, or
27
+ other commercial vendors. OpenTelemetry is focused on the generation,
28
+ collection, management, and export of telemetry. A major goal of OpenTelemetry
29
+ is that you can easily instrument your applications or systems, no matter their
30
+ language, infrastructure, or runtime environment. Crucially, the storage and
31
+ visualization of telemetry is intentionally left to other tools.
32
+
33
+ ## What does this crate contain?
34
+
35
+ This crate is basic foundation for integrating OpenTelemetry into libraries and
36
+ applications, encompassing several aspects of OpenTelemetry, such as context
37
+ management and propagation, baggage, logging, tracing, and metrics. It follows
38
+ the [ OpenTelemetry
39
+ specification] ( https://github.com/open-telemetry/opentelemetry-specification ) .
40
+ Here's a breakdown of its components:
41
+
42
+ - ** [ Context
43
+ API] ( https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/context/README.md ) :**
44
+ Provides a way to manage and propagate context, which is essential for keeping
45
+ track of trace execution across asynchronous tasks.
46
+ - ** [ Propagators
47
+ API] ( https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/context/api-propagators.md ) :**
48
+ Defines how context can be shared across process boundaries, ensuring
49
+ continuity across microservices or distributed systems.
50
+ - ** [ Baggage
51
+ API] ( https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/baggage/api.md ) :**
52
+ Allows for the attachment of metadata (baggage) to telemetry, which can be
53
+ used for sharing application-specific information across service boundaries.
54
+ - ** [ Logs Bridge
55
+ API] ( https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/api.md ) :**
56
+ Allows to bridge existing logging mechanisms with OpenTelemetry logging. This
57
+ is ** NOT** meant for end users to call, instead it is meant to enable writing
58
+ bridges/appenders for existing logging mechanisms such as
59
+ [ log] ( https://crates.io/crates/log ) or
60
+ [ tracing] ( https://crates.io/crates/tracing ) .
61
+ - ** [ Tracing
62
+ API] ( https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md ) :**
63
+ Offers a set of primitives to produce distributed traces to understand the
64
+ flow of a request across system boundaries.
65
+ - ** [ Metrics
66
+ API] ( https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md ) :**
67
+ Offers a set of primitives to produce measurements of operational metrics like
68
+ latency, throughput, or error rates.
69
+
70
+ This crate serves as a facade or no-op implementation, meaning it defines the
71
+ traits for instrumentation but does not itself implement the processing or
72
+ exporting of telemetry data. This separation of concerns allows library authors
73
+ to depend on the API crate without tying themselves to a specific
74
+ implementation.
75
+
76
+ Actual implementation and the heavy lifting of telemetry data collection,
77
+ processing, and exporting are delegated to the
78
+ [ opentelemetry-sdk] ( https://crates.io/crates/opentelemetry-sdk ) crate and
79
+ various exporter crates such as
80
+ [ opentelemetry-otlp] ( https://crates.io/crates/opentelemetry-otlp ) . This
81
+ architecture ensures that the final application can light up the instrumentation
82
+ by integrating an SDK implementation.
83
+
84
+ Library authors are recommended to depend on this crate * only* . This approach is
85
+ also aligned with the design philosophy of existing telemetry solutions in the
86
+ Rust ecosystem, like ` tracing ` or ` log ` , where these crates only offer a facade
87
+ and the actual functionality is enabled through additional crates.
88
+
89
+ ## Related crates
90
+
91
+ Unless you are a library author, you will almost always need to use additional
92
+ crates along with this. Given this crate has no-op implementation only, an
93
+ OpenTelemetry SDK is always required.
94
+ [ opentelemetry-sdk] ( https://crates.io/crates/opentelemetry-sdk ) is the official
95
+ SDK implemented by OpenTelemetry itself, though it is possible to use a
96
+ different sdk.
97
+
98
+ Additionally one or more exporters are also required to export telemetry to a
99
+ destination. OpenTelemetry provides the following exporters:
100
+
101
+ - ** [ opentelemetry-stdout] ( https://crates.io/crates/opentelemetry-stdout ) :**
102
+ Prints telemetry to stdout, primarily used for learning/debugging purposes.
103
+ - ** [ opentelemetry-otlp] ( https://crates.io/crates/opentelemetry-otlp ) :** Exports
104
+ telemetry (logs, metrics and traces) in the [ OTLP
105
+ format] ( https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/protocol )
106
+ to an endpoint accepting OTLP. This could be the [ OTel
107
+ Collector] ( https://github.com/open-telemetry/opentelemetry-collector ) ,
108
+ telemetry backends like [ Jaeger] ( https://www.jaegertracing.io/ ) ,
109
+ [ Prometheus] ( https://prometheus.io/docs/prometheus/latest/feature_flags/#otlp-receiver )
110
+ or [ vendor specific endpoints] ( https://opentelemetry.io/ecosystem/vendors/ ) .
111
+ - ** [ opentelemetry-zipkin] ( https://crates.io/crates/opentelemetry-zipkin ) :**
112
+ Exports telemetry (traces only) to Zipkin following [ OpenTelemetry to Zipkin
113
+ specification] ( https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/zipkin.md )
114
+ - ** [ opentelemetry-prometheus] ( https://crates.io/crates/opentelemetry-prometheus ) :**
115
+ Exports telemetry (metrics only) to Prometheus following [ OpenTelemetry to
116
+ Prometheus
117
+ specification] ( https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/prometheus.md )
118
+
119
+ OpenTelemetry Rust also has a [ contrib
120
+ repo] ( https://github.com/open-telemetry/opentelemetry-rust-contrib ) , where
121
+ additional exporters could be found. Check [ OpenTelemetry
122
+ Registry] ( https://opentelemetry.io/ecosystem/registry/?language=rust ) for
123
+ additional exporters and other related components as well.
124
+
125
+ ## Supported Rust Versions
126
+
127
+ This crate is built against the latest stable release. The minimum supported
128
+ version is 1.70. The current version is not guaranteed to build on Rust versions
129
+ earlier than the minimum supported version.
130
+
131
+ The current stable Rust compiler and the three most recent minor versions
132
+ before it will always be supported. For example, if the current stable
133
+ compiler version is 1.49, the minimum supported version will not be
134
+ increased past 1.46, three minor versions prior. Increasing the minimum
135
+ supported compiler version is not considered a semver breaking change as
136
+ long as doing so complies with this policy.
137
+
138
+ ## Usage
139
+
18
140
See [ docs] ( https://docs.rs/opentelemetry ) .
0 commit comments