Skip to content

feat(opentracing-shim): Map OpenTracing span.kind tag to OTel SpanKind#4953

Open
cabaret-pro wants to merge 2 commits intoopen-telemetry:mainfrom
cabaret-pro:feat/opentracing-shim-span-kind
Open

feat(opentracing-shim): Map OpenTracing span.kind tag to OTel SpanKind#4953
cabaret-pro wants to merge 2 commits intoopen-telemetry:mainfrom
cabaret-pro:feat/opentracing-shim-span-kind

Conversation

@cabaret-pro
Copy link
Contributor

Summary

  • Maps the OpenTracing span.kind tag to the OpenTelemetry SpanKind argument when creating spans via the shim
  • Adds a helper function opentracing_kind_to_otel_kind() in util.py with a constant mapping for CLIENT, SERVER, CONSUMER, and PRODUCER kinds
  • Preserves the span.kind tag in span attributes (shim does not modify user data)

Fixes #2549

Changes

  • util.py: Added _OPENTRACING_TO_OTEL_KIND constant and opentracing_kind_to_otel_kind() function
  • __init__.py: Modified start_span() to extract and convert the span.kind tag
  • Added unit tests for the mapping function and integration tests for span kind behavior
  • Updated CHANGELOG.md

Test Plan

  • python3 -m pytest shim/opentelemetry-opentracing-shim/tests/ -v - All 61 tests pass
  • tox -e precommit - All formatters/linters pass

Made with Cursor

@cabaret-pro cabaret-pro requested a review from a team as a code owner March 5, 2026 02:34
@cabaret-pro cabaret-pro force-pushed the feat/opentracing-shim-span-kind branch 2 times, most recently from 5ff08e5 to d121e33 Compare March 5, 2026 02:41
The OpenTracing shim was not translating the span.kind tag to the
OpenTelemetry SpanKind argument. This change extracts the span.kind
tag from OpenTracing spans and maps it to the corresponding OTel
SpanKind (CLIENT, SERVER, CONSUMER, PRODUCER, or INTERNAL).

The span.kind tag is preserved in the span attributes to avoid
modifying user data within the shim.

Fixes open-telemetry#2549

Made-with: Cursor
@cabaret-pro cabaret-pro force-pushed the feat/opentracing-shim-span-kind branch from d121e33 to fab489d Compare March 5, 2026 02:43
@cabaret-pro
Copy link
Contributor Author

The failing Core Contrib Test jobs (instrumentation-grpc-0 and processor-baggage) appear to be infrastructure issues unrelated to this PR. The tests are failing because they're trying to resolve dependencies from a non-existent git commit hash (a4f96df6913842d26a103f909a4206b3ab59a6f6).

All other checks are passing, including:

  • changelog
  • precommit checks (ruff, ruff-format)
  • EasyCLA
  • All other contrib tests (100+ passing)

@cabaret-pro
Copy link
Contributor Author

Update on CI failures:

After further investigation, the Core Contrib Test failures are expected for external contributor PRs. The CI is trying to install dependencies from:

git+https://github.com/open-telemetry/opentelemetry-python.git@fab489d6...

But commit fab489d6 only exists in my fork (cabaret-pro/opentelemetry-python), not in the upstream repo yet. These tests will pass once the PR is merged to main.

All tests that can be run against the fork are passing.

@xrmx
Copy link
Contributor

xrmx commented Mar 6, 2026

@cabaret-pro thanks for the PR, do you need this or are you going through issues to find something to fix?

@cabaret-pro
Copy link
Contributor Author

Mainly looking through issues but happy to work on something that's actively impacting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

In Opentracing Shim, set the Kind attribute

2 participants