Skip to content

_instrumentation in package.py for instrumentations#4178

Open
42Questions wants to merge 11 commits intoopen-telemetry:mainfrom
42Questions:hardcode-instrumentation-name-4173
Open

_instrumentation in package.py for instrumentations#4178
42Questions wants to merge 11 commits intoopen-telemetry:mainfrom
42Questions:hardcode-instrumentation-name-4173

Conversation

@42Questions
Copy link

@42Questions 42Questions commented Feb 7, 2026

Description

Refs #4173
Move _instrumentation_name to package.py and pass this to trace.get_tracer and metrics.get_meter during instrumentation. This ensures that instruments are created with the expected instrumentation scope name (e.g. opentelemetry.instrumentation.aio_pika).
Add new tests that show output uses new _instrumentation_name.
Do this for opentelemetry-instrumentation-aio-pika to establish pattern and then to roll out subsequently to other instrumentations.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Run tox tests for affected instrumentation pacakgestox -e py3-test-instrumentation-aio-pika-0 -- -k test_aio_pika_instrumentation -v — both existing and new test pass

Does This PR Require a Core Repo Change?

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@42Questions 42Questions marked this pull request as ready for review February 8, 2026 11:53
@42Questions 42Questions requested a review from a team as a code owner February 8, 2026 11:53
spans = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans), 1)
self.assertEqual(
spans[0].instrumentation_scope.name, _instrumentation_name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using the _instrumentation_name, can we make it hardcoded here?

@42Questions 42Questions changed the title Added _instrumentation in package.py pattern for aio_pika _instrumentation in package.py for instrumentations Feb 10, 2026
@emdneto emdneto moved this to Approved PRs that need fixes in @xrmx's Python PR digest Feb 11, 2026
@emdneto emdneto moved this from Approved PRs that need fixes to Easy to review / merge / close in @xrmx's Python PR digest Feb 11, 2026
@42Questions 42Questions requested review from emdneto and xrmx February 12, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Easy to review / merge / close

Development

Successfully merging this pull request may close these issues.

4 participants

Comments