Update OpenTelemetry integration to 0.32 - #38
Closed
rockwotj wants to merge 1 commit into
Closed
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OtelDataextension with the publicget_otel_contextAPIDispatchreference so event formatting can resolve the exact parent span without creating a reference cycleThis follows the dependency-bump direction of #35, updated for the current OpenTelemetry release used by downstream applications.
Compatibility
The
opentelemetryfeature 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, andlogging.googleapis.com/trace_sampled. Explicit event parents and nested spans are resolved through their registered subscriber context.Verification
cargo testcargo test --features opentelemetrycargo clippy --features opentelemetry -- -D warnings -A clippy::io-other-error -A clippy::needless-as-bytescargo fmt --check