Skip to content

Commit 6a32345

Browse files
authored
Merge branch 'main' into fix-changelogs
2 parents 33e6af9 + 1f7b6c4 commit 6a32345

File tree

8 files changed

+165
-128
lines changed

8 files changed

+165
-128
lines changed

README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,14 @@ The following crates are maintained in this repo:
100100
* [`opentelemetry-sdk`] This is the OpenTelemetry SDK crate, and contains the
101101
official OpenTelemetry SDK implementation. It contains Logging SDK, Metrics
102102
SDK, and Tracing SDK. It also contains propagator implementations.
103-
* [`opentelemetry-otlp`] exporter for sending logs, metrics and traces in the
104-
OTLP format to an endpoint accepting OTLP, like the [OpenTelemetry
105-
collector](https://opentelemetry.io/docs/collector/), or [vendor specific
106-
endpoints](https://opentelemetry.io/ecosystem/vendors/).
103+
* [`opentelemetry-otlp`] - exporter to send telemetry (logs, metrics and traces)
104+
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/).
107111
* [`opentelemetry-stdout`] exporter for sending logs, metrics and traces to
108112
stdout, for learning/debugging purposes.
109113
* [`opentelemetry-http`] This crate contains utility functions to help with

opentelemetry-jaeger/src/exporter/thrift/agent.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#![allow(unused_imports)]
55
#![allow(unused_extern_crates)]
6-
#![cfg_attr(feature = "cargo-clippy", allow(clippy::too_many_arguments, clippy::type_complexity))]
6+
#![cfg_attr(clippy, allow(clippy::too_many_arguments, clippy::type_complexity))]
77
#![cfg_attr(rustfmt, rustfmt_skip)]
88

99
extern crate thrift;

opentelemetry-jaeger/src/exporter/thrift/jaeger.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#![allow(unused_imports)]
55
#![allow(unused_extern_crates)]
6-
#![cfg_attr(feature = "cargo-clippy", allow(clippy::too_many_arguments, clippy::type_complexity))]
6+
#![cfg_attr(clippy, allow(clippy::too_many_arguments, clippy::type_complexity))]
77
#![cfg_attr(rustfmt, rustfmt_skip)]
88

99
extern crate thrift;

opentelemetry-jaeger/src/exporter/thrift/zipkincore.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#![allow(unused_imports)]
55
#![allow(unused_extern_crates)]
6-
#![cfg_attr(feature = "cargo-clippy", allow(clippy::too_many_arguments, clippy::type_complexity))]
6+
#![cfg_attr(clippy, allow(clippy::too_many_arguments, clippy::type_complexity))]
77
#![cfg_attr(rustfmt, rustfmt_skip)]
88

99
extern crate thrift;

opentelemetry-otlp/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## vNext
44

5+
### Added
6+
7+
- Added `DeltaTemporalitySelector` ([#1568])
8+
9+
[#1568]: https://github.com/open-telemetry/opentelemetry-rust/pull/1568
10+
511
## v0.15.0
612

713
### Added

opentelemetry-otlp/src/metric.rs

+39
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,16 @@ where
169169
}
170170
}
171171

172+
/// Build with delta temporality selector.
173+
///
174+
/// This temporality selector is equivalent to OTLP Metrics Exporter's
175+
/// `Delta` temporality preference (see [its documentation][exporter-docs]).
176+
///
177+
/// [exporter-docs]: https://github.com/open-telemetry/opentelemetry-specification/blob/a1c13d59bb7d0fb086df2b3e1eaec9df9efef6cc/specification/metrics/sdk_exporters/otlp.md#additional-configuration
178+
pub fn with_delta_temporality(self) -> Self {
179+
self.with_temporality_selector(DeltaTemporalitySelector)
180+
}
181+
172182
/// Build with the given aggregation selector
173183
pub fn with_aggregation_selector<T: AggregationSelector + 'static>(self, selector: T) -> Self {
174184
OtlpMetricPipeline {
@@ -248,6 +258,35 @@ impl<RT, EB: Debug> Debug for OtlpMetricPipeline<RT, EB> {
248258
}
249259
}
250260

261+
/// A temporality selector that returns [`Delta`][Temporality::Delta] for all
262+
/// instruments except `UpDownCounter` and `ObservableUpDownCounter`.
263+
///
264+
/// This temporality selector is equivalent to OTLP Metrics Exporter's
265+
/// `Delta` temporality preference (see [its documentation][exporter-docs]).
266+
///
267+
/// [exporter-docs]: https://github.com/open-telemetry/opentelemetry-specification/blob/a1c13d59bb7d0fb086df2b3e1eaec9df9efef6cc/specification/metrics/sdk_exporters/otlp.md#additional-configuration
268+
#[derive(Debug)]
269+
struct DeltaTemporalitySelector;
270+
271+
impl TemporalitySelector for DeltaTemporalitySelector {
272+
#[rustfmt::skip]
273+
fn temporality(&self, kind: InstrumentKind) -> Temporality {
274+
match kind {
275+
InstrumentKind::Counter
276+
| InstrumentKind::Histogram
277+
| InstrumentKind::ObservableCounter
278+
| InstrumentKind::Gauge
279+
| InstrumentKind::ObservableGauge => {
280+
Temporality::Delta
281+
}
282+
InstrumentKind::UpDownCounter
283+
| InstrumentKind::ObservableUpDownCounter => {
284+
Temporality::Cumulative
285+
}
286+
}
287+
}
288+
}
289+
251290
/// An interface for OTLP metrics clients
252291
#[async_trait]
253292
pub trait MetricsClient: fmt::Debug + Send + Sync + 'static {

opentelemetry/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "opentelemetry"
33
version = "0.22.0"
4-
description = "A metrics collection and distributed tracing framework"
4+
description = "OpenTelemetry API for Rust"
55
homepage = "https://github.com/open-telemetry/opentelemetry-rust"
66
repository = "https://github.com/open-telemetry/opentelemetry-rust"
77
readme = "README.md"

opentelemetry/README.md

+108-120
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
![OpenTelemetry — An observability framework for cloud-native software.][splash]
2-
3-
[splash]: https://raw.githubusercontent.com/open-telemetry/opentelemetry-rust/main/assets/logo-text.png
4-
51
# OpenTelemetry Rust
62

7-
The Rust [OpenTelemetry](https://opentelemetry.io/) implementation.
3+
This crate contains the [OpenTelemetry](https://opentelemetry.io/) API for Rust.
84

95
[![Crates.io: opentelemetry](https://img.shields.io/crates/v/opentelemetry.svg)](https://crates.io/crates/opentelemetry)
106
[![Documentation](https://docs.rs/opentelemetry/badge.svg)](https://docs.rs/opentelemetry)
@@ -15,124 +11,120 @@ The Rust [OpenTelemetry](https://opentelemetry.io/) implementation.
1511

1612
## Overview
1713

18-
OpenTelemetry is a collection of tools, APIs, and SDKs used to instrument,
19-
generate, collect, and export telemetry data (metrics, logs, and traces) for
20-
analysis in order to understand your software's performance and behavior. You
21-
can export and analyze them using [Prometheus], [Jaeger], and other
22-
observability tools.
14+
OpenTelemetry is an Observability framework and toolkit designed to create and
15+
manage telemetry data such as traces, metrics, and logs. OpenTelemetry is
16+
vendor- and tool-agnostic, meaning that it can be used with a broad variety of
17+
Observability backends, including open source tools like [Jaeger] and
18+
[Prometheus], as well as commercial offerings.
19+
20+
OpenTelemetry is *not* an observability backend like Jaeger, Prometheus, or other
21+
commercial vendors. OpenTelemetry is focused on the generation, collection,
22+
management, and export of telemetry. A major goal of OpenTelemetry is that you
23+
can easily instrument your applications or systems, no matter their language,
24+
infrastructure, or runtime environment. Crucially, the storage and visualization
25+
of telemetry is intentionally left to other tools.
2326

2427
*Compiler support: [requires `rustc` 1.64+][msrv]*
2528

2629
[Prometheus]: https://prometheus.io
2730
[Jaeger]: https://www.jaegertracing.io
2831
[msrv]: #supported-rust-versions
2932

30-
## Getting Started
31-
32-
```rust
33-
use opentelemetry::{
34-
global,
35-
sdk::trace::TracerProvider,
36-
trace::{Tracer, TracerProvider as _},
37-
};
38-
39-
fn main() {
40-
// Create a new trace pipeline that prints to stdout
41-
let provider = TracerProvider::builder()
42-
.with_simple_exporter(opentelemetry_stdout::SpanExporter::default())
43-
.build();
44-
let tracer = provider.tracer("readme_example");
45-
46-
tracer.in_span("doing_work", |cx| {
47-
// Traced app logic here...
48-
});
49-
50-
// Shutdown trace pipeline
51-
global::shutdown_tracer_provider();
52-
}
53-
```
54-
55-
See the [examples](../examples) directory for different integration patterns.
56-
57-
## Ecosystem
58-
59-
### Related Crates
60-
61-
In addition to `opentelemetry`, which only carries the API, the
62-
[`open-telemetry/opentelemetry-rust`] repository contains several additional
63-
crates designed to be used with the `opentelemetry` ecosystem. This includes a
64-
collection of trace `SpanExporter` and metrics pull and push controller
65-
implementations, as well as utility and adapter crates to assist in propagating
66-
state and instrumenting applications.
67-
68-
In particular, the following crates are likely to be of interest:
69-
70-
- [`opentelemetry-aws`] provides unofficial propagators for AWS X-ray.
71-
- [`opentelemetry-contrib`] provides additional exporters and propagators that
72-
are experimental.
73-
- [`opentelemetry-datadog`] provides additional exporters to [`Datadog`].
74-
- [`opentelemetry-dynatrace`] *Deprecated, last release 0.4.0* provides additional exporters to [`Dynatrace`]. See [README][`opentelemetry-dynatrace-readme`]
75-
- [`opentelemetry-http`] provides an interface for injecting and extracting
76-
trace information from [`http`] headers.
77-
- [`opentelemetry-jaeger`] provides a pipeline and exporter for sending trace
78-
information to [`Jaeger`].
79-
- [`opentelemetry-otlp`] exporter for sending trace and metric data in the OTLP
80-
format to the OpenTelemetry collector.
81-
- [`opentelemetry-prometheus`] provides a pipeline and exporter for sending
82-
metrics information to [`Prometheus`].
83-
- [`opentelemetry_sdk`] provides the standard reference implementation of
84-
opentelemetry.
85-
- [`opentelemetry-semantic-conventions`] provides standard names and semantic
86-
otel conventions.
87-
- [`opentelemetry-stackdriver`] provides an exporter for Google's [Cloud Trace]
88-
(which used to be called StackDriver).
89-
- [`opentelemetry-zipkin`] provides a pipeline and exporter for sending trace
90-
information to [`Zipkin`].
91-
92-
Additionally, there are also several third-party crates which are not
93-
maintained by the `opentelemetry` project. These include:
94-
95-
- [`tracing-opentelemetry`] provides integration for applications instrumented
96-
using the [`tracing`] API and ecosystem.
97-
- [`actix-web-opentelemetry`] provides integration for the [`actix-web`] web
98-
server and ecosystem.
99-
- [`opentelemetry-application-insights`] provides an unofficial [Azure
100-
Application Insights] exporter.
101-
- [`opentelemetry-tide`] provides integration for the [`Tide`] web server and
102-
ecosystem.
103-
104-
If you're the maintainer of an `opentelemetry` ecosystem crate not listed
105-
above, please let us know! We'd love to add your project to the list!
106-
107-
[`open-telemetry/opentelemetry-rust`]: https://github.com/open-telemetry/opentelemetry-rust
108-
[`opentelemetry-jaeger`]: https://crates.io/crates/opentelemetry-jaeger
109-
[`Jaeger`]: https://www.jaegertracing.io
110-
[`opentelemetry-otlp`]: https://crates.io/crates/opentelemetry-otlp
111-
[`opentelemetry-http`]: https://crates.io/crates/opentelemetry-http
112-
[`opentelemetry-prometheus`]: https://crates.io/crates/opentelemetry-prometheus
113-
[`opentelemetry-aws`]: https://crates.io/crates/opentelemetry-aws
114-
[`Prometheus`]: https://prometheus.io
115-
[`opentelemetry-zipkin`]: https://crates.io/crates/opentelemetry-zipkin
116-
[`Zipkin`]: https://zipkin.io
117-
[`opentelemetry-contrib`]: https://crates.io/crates/opentelemetry-contrib
118-
[`Datadog`]: https://www.datadoghq.com
119-
[`Dynatrace`]: https://www.dynatrace.com
120-
[`opentelemetry-datadog`]: https://crates.io/crates/opentelemetry-datadog
121-
[`opentelemetry-dynatrace`]: https://crates.io/crates/opentelemetry-dynatrace
122-
[`opentelemetry-dynatrace-readme`]: https://github.com/open-telemetry/opentelemetry-rust-contrib/blob/main/opentelemetry-dynatrace/README.md
123-
[`opentelemetry-semantic-conventions`]: https://crates.io/crates/opentelemetry-semantic-conventions
124-
[`http`]: https://crates.io/crates/http
125-
126-
[`tracing-opentelemetry`]: https://crates.io/crates/tracing-opentelemetry
127-
[`tracing`]: https://crates.io/crates/tracing
128-
[`actix-web-opentelemetry`]: https://crates.io/crates/actix-web-opentelemetry
129-
[`actix-web`]: https://crates.io/crates/actix-web
130-
[`opentelemetry-application-insights`]: https://crates.io/crates/opentelemetry-application-insights
131-
[Azure Application Insights]: https://docs.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview
132-
[`opentelemetry-tide`]: https://crates.io/crates/opentelemetry-tide
133-
[`Tide`]: https://crates.io/crates/tide
134-
[`opentelemetry-stackdriver`]: https://crates.io/crates/opentelemetry-stackdriver
135-
[Cloud Trace]: https://cloud.google.com/trace/
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/bridge-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+
## Getting started
126+
127+
See [docs](https://docs.rs/opentelemetry).
136128

137129
## Supported Rust Versions
138130

@@ -146,7 +138,3 @@ version is 1.49, the minimum supported version will not be increased past 1.46,
146138
three minor versions prior. Increasing the minimum supported compiler version
147139
is not considered a semver breaking change as long as doing so complies with
148140
this policy.
149-
150-
## Contributing
151-
152-
See the [contributing file](../CONTRIBUTING.md).

0 commit comments

Comments
 (0)