Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

Jules PR

The `with_opentelemetry_ids` method contained repetitive code for handling different versions of the `tracing-opentelemetry` crate. This commit extracts the common logic into a macro called `otel_extraction`.

The macro takes the feature name, the `OtelData` type, and the `opentelemetry` trace package path as arguments, and generates the necessary code to extract the trace and span IDs.

This refactoring improves code maintainability and reduces duplication.
This commit refactors the `otel_extraction` macro to accept crate identifiers directly, rather than full paths to types. This simplifies the macro invocations and makes the code cleaner and easier to read.

The macro now constructs the necessary paths to `OtelData` and `trace` internally.

This change improves the developer experience when adding support for new OpenTelemetry versions.
@mladedav mladedav changed the title Jules PR Extract opentelemetry ID retrieval code into a macro Aug 8, 2025
@mladedav mladedav marked this pull request as ready for review August 8, 2025 11:35
@mladedav mladedav merged commit 9177a10 into main Aug 8, 2025
10 checks passed
@mladedav mladedav deleted the jules/refactor-otel-macro branch August 8, 2025 11:36
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.

2 participants