Skip to content

Commit 51577f4

Browse files
authored
Merge branch 'main' into perf-improve
2 parents 8c29666 + ad0552a commit 51577f4

File tree

42 files changed

+1062
-528
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1062
-528
lines changed

.github/workflows/ci.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ jobs:
6262
- uses: arduino/setup-protoc@v3
6363
with:
6464
repo-token: ${{ secrets.GITHUB_TOKEN }}
65-
- uses: actions-rs/cargo@v1
66-
with:
67-
command: fmt
68-
args: --all -- --check
65+
- name: Format
66+
run: cargo fmt --all -- --check
6967
- name: Lint
7068
run: bash ./scripts/lint.sh
7169
external-types:

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ documentation.
3131
| Signal/Component | Overall Status |
3232
| -------------------- | ------------------ |
3333
| Context | Beta |
34-
| Baggage | Beta |
34+
| Baggage | RC |
3535
| Propagators | Beta |
3636
| Logs-API | Stable* |
37-
| Logs-SDK | RC |
37+
| Logs-SDK | Stable |
3838
| Logs-OTLP Exporter | RC |
39-
| Logs-Appender-Tracing | RC |
39+
| Logs-Appender-Tracing | Stable |
4040
| Metrics-API | Stable |
4141
| Metrics-SDK | RC |
4242
| Metrics-OTLP Exporter | RC |

docs/migration_0.29.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Migration Guide from 0.28 to 0.29
2+
3+
OpenTelemetry Rust 0.29 introduces a few breaking changes. This guide aims to
4+
facilitate a smooth migration for common use cases involving the
5+
`opentelemetry`, `opentelemetry_sdk`, `opentelemetry-otlp`, and
6+
`opentelemetry-appender-tracing` crates. For a comprehensive list of changes,
7+
please refer to the detailed changelog for each crate. This document covers only
8+
the most common scenarios. Note that changes that only affect custom
9+
exporter/processor authors are not mentioned in this doc.
10+
11+
OpenTelemetry Metrics API and Log-Bridge API were declared stable in 0.28, and have
12+
no breaking changes.
13+
14+
## Baggage Changes
15+
16+
The Baggage API has been redesigned to align with the OpenTelemetry
17+
specification. While the core API for interacting with Baggage remains the same,
18+
the accepted data types have changed. Baggage Keys now only allow strings (ASCII
19+
printable characters), and Baggage values are restricted to strings.
20+
21+
For detailed changes, see the [changelog](../opentelemetry/CHANGELOG.md). With
22+
version 0.29, the Baggage API has reached "Release Candidate" status, meaning
23+
further breaking changes will be highly restricted.
24+
25+
## Appender-Tracing Changes
26+
27+
The `opentelemetry-appender-tracing` crate, which bridges `tracing` events to
28+
OpenTelemetry logs, has been updated to properly map `tracing` data types to the
29+
OpenTelemetry model. As of version 0.29, this crate is considered "Stable," and
30+
no further breaking changes will be made without a major version bump.
31+
32+
## Configuration via Environment Variables
33+
34+
The 0.29 release aligns OpenTelemetry Rust with the rest of the OpenTelemetry
35+
ecosystem by treating any code-based configuration as final (i.e., it cannot be
36+
overridden by environment variables). This policy was partially true before but
37+
is now applied consistently. If you prefer to configure your application via
38+
environment variables, avoid configuring it programmatically.
39+
40+
## Discontinuing Dedicated Prometheus Exporter
41+
42+
The `opentelemetry-prometheus` crate will be discontinued with the 0.29 release.
43+
Active development on this crate ceased a few months ago. Given that Prometheus
44+
now natively supports OTLP, and considering that the OpenTelemetry Rust project
45+
is still working towards a 1.0 release, we need to focus on essential components
46+
to maintain scope and ensure timely delivery.
47+
48+
Prometheus interoperability remains a key goal for OpenTelemetry. However, the
49+
current `opentelemetry-prometheus` crate requires a major rewrite to eliminate
50+
dependencies on unmaintained crates. We may reintroduce a dedicated Prometheus
51+
exporter in the future once these issues are resolved.
52+
53+
### Migration Guide
54+
55+
For those using Prometheus as a backend, you can integrate with Prometheus using
56+
the following methods:
57+
58+
1. Use the OTLP Exporter to push metrics directly to Prometheus.
59+
2. If you require a pull (scrape) model, push metrics to an OpenTelemetry
60+
Collector using the OTLP Exporter, and configure Prometheus to scrape the
61+
OpenTelemetry Collector.
62+
63+
These alternatives ensure continued Prometheus integration while allowing us to
64+
focus on achieving a stable 1.0 release for OpenTelemetry Rust.
65+
66+
## Next Release
67+
68+
In the [next
69+
release](https://github.com/open-telemetry/opentelemetry-rust/milestone/21), we
70+
expect to stabilize the Metrics SDK and resolve the long-standing question of
71+
`tokio-tracing` vs. `opentelemetry tracing`, which is a prerequisite before
72+
stabilizing Distributed Tracing. Additionally, `Context` is also expected to be
73+
enhanced with the ability to suppress telemetry-induced-telemetry.
74+
75+
## Instrumentation Libraries
76+
77+
Unlike other OpenTelemetry language implementations, OpenTelemetry Rust historically did not
78+
maintain any instrumentations directly. This has recently changed with a
79+
[contribution](https://github.com/open-telemetry/opentelemetry-rust-contrib/pull/202)
80+
from one of the founding members of the OpenTelemetry Rust project to the
81+
contrib repository, providing an instrumentation library for
82+
[`actix-web`](https://github.com/open-telemetry/opentelemetry-rust-contrib/tree/main/actix-web-opentelemetry).
83+
We expect that this instrumentation will serve as a reference implementation demonstrating best practices for
84+
creating OpenTelemetry instrumentations in Rust.
85+
86+
We welcome additional contributions of instrumentation libraries to the contrib repository.
87+
88+
## Thanks
89+
90+
Thank you to everyone who contributed to this milestone. Please share your feedback
91+
through GitHub issues or join the discussion in the OTel-Rust Slack channel
92+
[here](https://cloud-native.slack.com/archives/C03GDP0H023).

opentelemetry-appender-log/CHANGELOG.md

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

33
## vNext
44

5+
## 0.29.0
6+
7+
Released 2025-Mar-21
8+
59
- Similar to the `opentelemetry-appender-tracing` fix [2658](https://github.com/open-telemetry/opentelemetry-rust/issues/2658)
610
InstrumentationScope(Logger) used by the appender now uses an empty ("") named Logger.
711
Previously, a Logger with name and version of the crate was used.
812
Receivers (processors, exporters) are expected to use `LogRecord.target()` as scope name.
913
This is already done in OTLP Exporters, so this change should be transparent to most users.
14+
- Update `opentelemetry` dependency version to 0.29.
15+
- Update `opentelemetry-semantic-conventions` dependency version to 0.29.
1016

1117
## 0.28.0
1218

opentelemetry-appender-log/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "opentelemetry-appender-log"
3-
version = "0.28.0"
3+
version = "0.29.0"
44
description = "An OpenTelemetry appender for the log crate"
55
homepage = "https://github.com/open-telemetry/opentelemetry-rust/tree/main/opentelemetry-appender-log"
66
repository = "https://github.com/open-telemetry/opentelemetry-rust/tree/main/opentelemetry-appender-log"
@@ -11,12 +11,12 @@ rust-version = "1.75.0"
1111
edition = "2021"
1212

1313
[dependencies]
14-
opentelemetry = { version = "0.28", path = "../opentelemetry", features = [
14+
opentelemetry = { version = "0.29", path = "../opentelemetry", features = [
1515
"logs",
1616
] }
1717
log = { workspace = true, features = ["kv", "std"] }
1818
serde = { workspace = true, optional = true, features = ["std"] }
19-
opentelemetry-semantic-conventions = { version = "0.28", path = "../opentelemetry-semantic-conventions", optional = true, features = [
19+
opentelemetry-semantic-conventions = { version = "0.29", path = "../opentelemetry-semantic-conventions", optional = true, features = [
2020
"semconv_experimental",
2121
] }
2222

opentelemetry-appender-tracing/CHANGELOG.md

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

33
## vNext
44

5+
## 0.29.0
6+
7+
Released 2025-Mar-21
8+
59
Fixes [1682](https://github.com/open-telemetry/opentelemetry-rust/issues/1682).
610
"spec_unstable_logs_enabled" feature now do not suppress logs for other layers.
711

@@ -53,6 +57,7 @@ of string.
5357
instead of previously reporting the user provided attribute "error".
5458
`error!(....error = &OTelSdkError::AlreadyShutdown as &dyn std::error::Error...)`
5559
- perf - small perf improvement by avoiding string allocation of `target`
60+
- Update `opentelemetry` dependency version to 0.29.
5661

5762
## 0.28.1
5863

opentelemetry-appender-tracing/Cargo.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ rust-version = "1.75.0"
1212

1313
[dependencies]
1414
log = { workspace = true, optional = true }
15-
opentelemetry = { version = "0.28", path = "../opentelemetry", features = ["logs"] }
15+
opentelemetry = { version = "0.29", path = "../opentelemetry", features = ["logs"] }
1616
tracing = { workspace = true, features = ["std"]}
1717
tracing-core = { workspace = true }
1818
tracing-log = { workspace = true, optional = true }
1919
tracing-subscriber = { workspace = true, features = ["registry", "std"] }
20-
tracing-opentelemetry = { workspace = true, optional = true }
20+
# tracing-opentelemetry = { workspace = true, optional = true }
2121

2222
[dev-dependencies]
2323
log = { workspace = true }
@@ -36,7 +36,8 @@ pprof = { version = "0.14", features = ["flamegraph", "criterion"] }
3636
default = []
3737
experimental_metadata_attributes = ["dep:tracing-log"]
3838
spec_unstable_logs_enabled = ["opentelemetry/spec_unstable_logs_enabled"]
39-
experimental_use_tracing_span_context = ["tracing-opentelemetry"]
39+
# TODO - Enable this in 0.29.1 (once tracing-opentelemetry v0.30 is released)
40+
# experimental_use_tracing_span_context = ["tracing-opentelemetry"]
4041

4142

4243
[[bench]]

opentelemetry-appender-tracing/src/layer.rs

+66-66
Original file line numberDiff line numberDiff line change
@@ -244,25 +244,25 @@ where
244244
// Visit fields.
245245
event.record(&mut visitor);
246246

247-
#[cfg(feature = "experimental_use_tracing_span_context")]
248-
if let Some(span) = _ctx.event_span(event) {
249-
use tracing_opentelemetry::OtelData;
250-
let opt_span_id = span
251-
.extensions()
252-
.get::<OtelData>()
253-
.and_then(|otd| otd.builder.span_id);
254-
255-
let opt_trace_id = span.scope().last().and_then(|root_span| {
256-
root_span
257-
.extensions()
258-
.get::<OtelData>()
259-
.and_then(|otd| otd.builder.trace_id)
260-
});
261-
262-
if let Some((trace_id, span_id)) = opt_trace_id.zip(opt_span_id) {
263-
log_record.set_trace_context(trace_id, span_id, None);
264-
}
265-
}
247+
// #[cfg(feature = "experimental_use_tracing_span_context")]
248+
// if let Some(span) = _ctx.event_span(event) {
249+
// use tracing_opentelemetry::OtelData;
250+
// let opt_span_id = span
251+
// .extensions()
252+
// .get::<OtelData>()
253+
// .and_then(|otd| otd.builder.span_id);
254+
255+
// let opt_trace_id = span.scope().last().and_then(|root_span| {
256+
// root_span
257+
// .extensions()
258+
// .get::<OtelData>()
259+
// .and_then(|otd| otd.builder.trace_id)
260+
// });
261+
262+
// if let Some((trace_id, span_id)) = opt_trace_id.zip(opt_span_id) {
263+
// log_record.set_trace_context(trace_id, span_id, None);
264+
// }
265+
// }
266266

267267
//emit record
268268
self.logger.emit(log_record);
@@ -673,66 +673,66 @@ mod tests {
673673
}
674674
}
675675

676-
#[cfg(feature = "experimental_use_tracing_span_context")]
677-
#[test]
678-
fn tracing_appender_inside_tracing_crate_context() {
679-
use opentelemetry_sdk::trace::InMemorySpanExporterBuilder;
676+
// #[cfg(feature = "experimental_use_tracing_span_context")]
677+
// #[test]
678+
// fn tracing_appender_inside_tracing_crate_context() {
679+
// use opentelemetry_sdk::trace::InMemorySpanExporterBuilder;
680680

681-
// Arrange
682-
let exporter: InMemoryLogExporter = InMemoryLogExporter::default();
683-
let logger_provider = SdkLoggerProvider::builder()
684-
.with_simple_exporter(exporter.clone())
685-
.build();
681+
// // Arrange
682+
// let exporter: InMemoryLogExporter = InMemoryLogExporter::default();
683+
// let logger_provider = SdkLoggerProvider::builder()
684+
// .with_simple_exporter(exporter.clone())
685+
// .build();
686686

687-
// setup tracing layer to compare trace/span IDs against
688-
let span_exporter = InMemorySpanExporterBuilder::new().build();
689-
let tracer_provider = SdkTracerProvider::builder()
690-
.with_simple_exporter(span_exporter.clone())
691-
.build();
692-
let tracer = tracer_provider.tracer("test-tracer");
687+
// // setup tracing layer to compare trace/span IDs against
688+
// let span_exporter = InMemorySpanExporterBuilder::new().build();
689+
// let tracer_provider = SdkTracerProvider::builder()
690+
// .with_simple_exporter(span_exporter.clone())
691+
// .build();
692+
// let tracer = tracer_provider.tracer("test-tracer");
693693

694-
let level_filter = tracing_subscriber::filter::LevelFilter::ERROR;
695-
let log_layer =
696-
layer::OpenTelemetryTracingBridge::new(&logger_provider).with_filter(level_filter);
694+
// let level_filter = tracing_subscriber::filter::LevelFilter::ERROR;
695+
// let log_layer =
696+
// layer::OpenTelemetryTracingBridge::new(&logger_provider).with_filter(level_filter);
697697

698-
let subscriber = tracing_subscriber::registry()
699-
.with(log_layer)
700-
.with(tracing_opentelemetry::layer().with_tracer(tracer));
698+
// let subscriber = tracing_subscriber::registry()
699+
// .with(log_layer)
700+
// .with(tracing_opentelemetry::layer().with_tracer(tracer));
701701

702-
// Avoiding global subscriber.init() as that does not play well with unit tests.
703-
let _guard = tracing::subscriber::set_default(subscriber);
702+
// // Avoiding global subscriber.init() as that does not play well with unit tests.
703+
// let _guard = tracing::subscriber::set_default(subscriber);
704704

705-
// Act
706-
tracing::error_span!("outer-span").in_scope(|| {
707-
error!("first-event");
705+
// // Act
706+
// tracing::error_span!("outer-span").in_scope(|| {
707+
// error!("first-event");
708708

709-
tracing::error_span!("inner-span").in_scope(|| {
710-
error!("second-event");
711-
});
712-
});
709+
// tracing::error_span!("inner-span").in_scope(|| {
710+
// error!("second-event");
711+
// });
712+
// });
713713

714-
assert!(logger_provider.force_flush().is_ok());
714+
// assert!(logger_provider.force_flush().is_ok());
715715

716-
let logs = exporter.get_emitted_logs().expect("No emitted logs");
717-
assert_eq!(logs.len(), 2, "Expected 2 logs, got: {logs:?}");
716+
// let logs = exporter.get_emitted_logs().expect("No emitted logs");
717+
// assert_eq!(logs.len(), 2, "Expected 2 logs, got: {logs:?}");
718718

719-
let spans = span_exporter.get_finished_spans().unwrap();
720-
assert_eq!(spans.len(), 2);
719+
// let spans = span_exporter.get_finished_spans().unwrap();
720+
// assert_eq!(spans.len(), 2);
721721

722-
let trace_id = spans[0].span_context.trace_id();
723-
assert_eq!(trace_id, spans[1].span_context.trace_id());
724-
let inner_span_id = spans[0].span_context.span_id();
725-
let outer_span_id = spans[1].span_context.span_id();
726-
assert_eq!(outer_span_id, spans[0].parent_span_id);
722+
// let trace_id = spans[0].span_context.trace_id();
723+
// assert_eq!(trace_id, spans[1].span_context.trace_id());
724+
// let inner_span_id = spans[0].span_context.span_id();
725+
// let outer_span_id = spans[1].span_context.span_id();
726+
// assert_eq!(outer_span_id, spans[0].parent_span_id);
727727

728-
let trace_ctx0 = logs[0].record.trace_context().unwrap();
729-
let trace_ctx1 = logs[1].record.trace_context().unwrap();
728+
// let trace_ctx0 = logs[0].record.trace_context().unwrap();
729+
// let trace_ctx1 = logs[1].record.trace_context().unwrap();
730730

731-
assert_eq!(trace_ctx0.trace_id, trace_id);
732-
assert_eq!(trace_ctx1.trace_id, trace_id);
733-
assert_eq!(trace_ctx0.span_id, outer_span_id);
734-
assert_eq!(trace_ctx1.span_id, inner_span_id);
735-
}
731+
// assert_eq!(trace_ctx0.trace_id, trace_id);
732+
// assert_eq!(trace_ctx1.trace_id, trace_id);
733+
// assert_eq!(trace_ctx0.span_id, outer_span_id);
734+
// assert_eq!(trace_ctx1.span_id, inner_span_id);
735+
// }
736736

737737
#[test]
738738
fn tracing_appender_standalone_with_tracing_log() {

opentelemetry-http/CHANGELOG.md

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

33
## vNext
44

5+
## 0.29.0
6+
7+
Released 2025-Mar-21
8+
9+
- Update `opentelemetry` dependency version to 0.29.
10+
511
## 0.28.0
612

713
Released 2025-Feb-10

opentelemetry-http/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "opentelemetry-http"
3-
version = "0.28.0"
3+
version = "0.29.0"
44
description = "Helper implementations for sending HTTP requests. Uses include propagating and extracting context over http, exporting telemetry, requesting sampling strategies."
55
homepage = "https://github.com/open-telemetry/opentelemetry-rust/tree/main/opentelemetry-http"
66
repository = "https://github.com/open-telemetry/opentelemetry-rust/tree/main/opentelemetry-http"
@@ -23,7 +23,7 @@ http = { workspace = true }
2323
http-body-util = { workspace = true, optional = true }
2424
hyper = { workspace = true, optional = true }
2525
hyper-util = { workspace = true, features = ["client-legacy", "http1", "http2"], optional = true }
26-
opentelemetry = { version = "0.28", path = "../opentelemetry", features = ["trace"] }
26+
opentelemetry = { version = "0.29", path = "../opentelemetry", features = ["trace"] }
2727
reqwest = { workspace = true, features = ["blocking"], optional = true }
2828
tokio = { workspace = true, features = ["time"], optional = true }
2929
tracing = {workspace = true, optional = true}

0 commit comments

Comments
 (0)