Skip to content

Fix: test_install_shim_affects_existing_tracers assumes wrong default tracer type#5047

Open
sakshar2303 wants to merge 2 commits intoopen-telemetry:mainfrom
sakshar2303:main
Open

Fix: test_install_shim_affects_existing_tracers assumes wrong default tracer type#5047
sakshar2303 wants to merge 2 commits intoopen-telemetry:mainfrom
sakshar2303:main

Conversation

@sakshar2303
Copy link
Copy Markdown

The test was incorrectly assuming that Tracer() creates a NoopTracer,
but OpenCensus 0.11.1 creates a ContextTracer by default.

Updated the test to:

  1. Remove dependency on OpenCensus's internal defaults
  2. Verify the actual behavior that matters: the shim patches existing tracers
  3. Assert ShimTracer wraps a NoopTracer (via wrapt.ObjectProxy)

All tests pass.

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Apr 6, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: MikeGoldsmith / name: Mike Goldsmith (487a6e2)
  • ✅ login: sakshar2303 / name: Sakshar Dhawan (3a8b78e)

Copy link
Copy Markdown
Member

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

Looks good - thanks @sakshar2303. I've left one minor suggestion.

You'll need to a changelog entry too please.

Comment on lines +45 to +46
original_tracer = oc_tracer.tracer
self.assertNotIsInstance(original_tracer, ShimTracer)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we do this instead of creating a tracer instance?

Suggested change
original_tracer = oc_tracer.tracer
self.assertNotIsInstance(original_tracer, ShimTracer)
self.assertNotIsInstance(oc_tracer.tracer, ShimTracer)

@MikeGoldsmith MikeGoldsmith added Skip Changelog PRs that do not require a CHANGELOG.md entry and removed Skip Changelog PRs that do not require a CHANGELOG.md entry labels Apr 13, 2026
@MikeGoldsmith MikeGoldsmith moved this to Approved PRs that need fixes in Python PR digest Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Approved PRs that need fixes

Development

Successfully merging this pull request may close these issues.

2 participants