Skip to content

opentelemetry-instrumentation-kafka-python: add NoOpTracerProvider tests - #5319

Open
MarcoYataco wants to merge 2 commits into
open-telemetry:mainfrom
MarcoYataco:test/kafka-noop-tracer-provider
Open

MarcoYataco wants to merge 2 commits into
open-telemetry:mainfrom
MarcoYataco:test/kafka-noop-tracer-provider

Conversation

@MarcoYataco

Copy link
Copy Markdown

Description

Add tests for NoOpTracerProvider in opentelemetry-instrumentation-kafka-python.

The changes cover:

  • Producer instrumentation using a NoOp tracer, verifying that the original send operation is called and the span is not recording.
  • Consumer instrumentation using a NoOp tracer, verifying that the original consume operation is called and the span is not recording.
  • KafkaInstrumentor.instrument(tracer_provider=...), verifying that the provided tracer provider is forwarded, the instrumented send operation executes, and the resulting span is non-recording with an invalid span context.

No production code or additional dependencies were changed.

Fixes #977

Type of change

  • Tests / improved test coverage
  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

How Has This Been Tested?

Executed locally on Windows with Python 3.14:

  • py -m tox -e py314-test-instrumentation-kafka-python-latest — 21 passed.
  • py -m tox -e py314-test-instrumentation-kafka-python-oldest — 21 passed.
  • py -m tox -e ruff — passed.
  • Pylint checks on both modified test files — 10.00/10.
  • git diff --cached --check — passed.

Kafka operations are mocked; no Kafka broker is required.

Does This PR Require a Core Repo Change?

  • Yes
  • No

Checklist

  • Followed the project's style guidelines
  • Unit tests have been added
  • Changelog updated — test-only change; requesting Skip Changelog
  • Documentation updated — not required for test-only changes

@linux-foundation-easycla

linux-foundation-easycla Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-11-11 00:14 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@MarcoYataco

Copy link
Copy Markdown
Author

/easycla

This branch has not been deployed

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Audit and test opentelemetry-instrumentation-kafka-python

2 participants