Repository navigation
Modify logic to add providers when azure monitor config is disabled - #24
Merged
Radhika Gupta (rads-1996) merged 4 commits intoApr 10, 2026
Merged
Radhika Gupta (rads-1996) merged 4 commits into
Radhika Gupta (rads-1996) merged 4 commits into
Conversation
Radhika Gupta (rads-1996)
requested review from
Jackson Weber (JacksonWeber),
Nev (MSNev),
Hector Hernandez (hectorhdzg) and
Leighton Chen (lzchen)
as code owners
April 9, 2026 19:45
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates use_microsoft_opentelemetry() orchestration so that when Azure Monitor is explicitly disabled, the distro still initializes “bare” OpenTelemetry providers, while Azure Monitor-enabled scenarios delegate provider creation/configuration to Azure Monitor setup.
Changes:
- Move core provider initialization to the
enable_azure_monitor=Falsepath (create tracing/metrics/logging providers even without an exporter). - Delegate Azure Monitor-enabled setup entirely to
_setup_azure_monitor(**merged)and run instrumentations after providers are set. - Update unit tests and add a changelog entry reflecting the new behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/microsoft/opentelemetry/_distro.py |
Restructures provider initialization vs. Azure Monitor setup and reorders instrumentation setup. |
tests/test_distro.py |
Updates mocks/assertions to match the new orchestration and disabled-Azure-Monitor provider behavior. |
CHANGELOG.md |
Documents the behavior change in release notes. |
Comments suppressed due to low confidence (1)
tests/test_distro.py:167
test_setup_tracing_adds_span_processorsnow calls_setup_tracing()without patchingset_tracer_provider, so it mutates global OpenTelemetry state and can make this test order-dependent. It also doesn’t assert that the span processor was actually added (despite the comment). Patchset_tracer_provider(as in the previous test) and assert that the created provider contains the supplied processor.
def test_setup_tracing_adds_span_processors(self):
"""_setup_tracing adds user-supplied span processors."""
sp = MagicMock()
tp = _setup_tracing(TEST_RESOURCE, {"span_processors": [sp]})
# Processor is in the provider's active span processors
self.assertIsInstance(tp, TracerProvider)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Hector Hernandez (hectorhdzg)
requested a review
from Jeremy Voss (jeremydvoss)
as a code owner
April 9, 2026 22:24
Hector Hernandez (hectorhdzg)
approved these changes
Apr 9, 2026
Hector Hernandez (hectorhdzg)
approved these changes
Apr 10, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.