Skip to content

Update OpenTelemetry integration to 0.32 - #38

Closed
rockwotj wants to merge 1 commit into
NAlexPear:masterfrom
rockwotj:rockwood/opentelemetry-0.32
Closed

Update OpenTelemetry integration to 0.32#38
rockwotj wants to merge 1 commit into
NAlexPear:masterfrom
rockwotj:rockwood/opentelemetry-0.32

Conversation

@rockwotj

@rockwotj rockwotj commented Aug 6, 2026

Copy link
Copy Markdown

Summary

  • update the optional Cloud Trace integration to OpenTelemetry 0.32 and tracing-opentelemetry 0.33
  • replace access to the now-private OtelData extension with the public get_otel_context API
  • retain the subscriber as a weak Dispatch reference so event formatting can resolve the exact parent span without creating a reference cycle
  • update the OpenTelemetry tests and crate version for the new compatibility line

This follows the dependency-bump direction of #35, updated for the current OpenTelemetry release used by downstream applications.

Compatibility

The opentelemetry feature now targets OpenTelemetry 0.32. Applications on the old 0.22 API should remain on tracing-stackdriver 0.10.

The formatter continues to emit logging.googleapis.com/trace, logging.googleapis.com/spanId, and logging.googleapis.com/trace_sampled. Explicit event parents and nested spans are resolved through their registered subscriber context.

Verification

  • cargo test
  • cargo test --features opentelemetry
  • cargo clippy --features opentelemetry -- -D warnings -A clippy::io-other-error -A clippy::needless-as-bytes
  • cargo fmt --check

tracing-stackdriver's optional Cloud Trace correlation still depends on OpenTelemetry 0.22 and tracing-opentelemetry 0.23. Applications using the current 0.32/0.33 stack therefore cannot enable correlation without compiling two incompatible telemetry type universes.

Move the optional integration to OpenTelemetry 0.32 and tracing-opentelemetry 0.33, and bump the crate version to 0.11. The newer tracing-opentelemetry release makes its internal OtelData private, so retain a weak reference to the registered Dispatch and use the public get_otel_context API to resolve the exact event parent span. The weak reference avoids a subscriber reference cycle and preserves explicit-parent and nested-span behavior.

Update the OpenTelemetry test provider and ID constructors for the current APIs. Also register the existing tracing_unstable cfg so current Rust releases do not warn about the crate's valuable integration gates.

Verified with cargo test, cargo test --features opentelemetry, and cargo clippy --features opentelemetry -- -D warnings with allowances for two pre-existing writer lints.
@rockwotj rockwotj closed this Aug 6, 2026
@rockwotj
rockwotj deleted the rockwood/opentelemetry-0.32 branch August 6, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant