Revert adding azure monitor distro in sdkVersion#46963
Open
rads-1996 wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reverts use of the Azure Monitor distro environment variable when composing the exporter SDK version, so SDK version reporting falls back to exporter version unless Microsoft OpenTelemetry is explicitly detected.
Changes:
- Removed
AZURE_MONITOR_DISTRO_VERSIONhandling from exporter SDK version generation. - Updated related SDK version tests.
- Added a changelog entry for the bug fix.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py |
Removes distro env var lookup from _get_sdk_version(). |
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_constants.py |
Removes the unused distro SDK-version environment variable constant. |
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_utils.py |
Updates SDK version unit tests for the reverted behavior. |
sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md |
Documents the SDK version behavior fix. |
Comments suppressed due to low confidence (3)
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_utils.py:831
- This updated test no longer sets
AZURE_MONITOR_DISTRO_VERSION, so it only verifies the default path instead of the regression this PR is intended to cover. Keep the distro environment variable present and assert that_get_sdk_version()still returns the exporter version; otherwise the olddst...behavior could be reintroduced without this test failing.
@patch.dict(
"azure.monitor.opentelemetry.exporter._utils.environ",
clear=True,
)
def test_get_sdk_version_distro(self, mock_python_version, mock_prefix):
result = _utils._get_sdk_version()
self.assertEqual(result, "uum_py3.11.0:otel1.20.0:ext{}".format(_utils.ext_version))
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_utils.py:831
- This assertion hard-codes the package's current
_version.VERSIONwithout patchingazure.monitor.opentelemetry.exporter._utils.ext_version, unlike the default-version test above. The next version bump will make this unrelated test fail unless it is updated, so it should either patchext_versionor compare against the imported value.
self.assertEqual(result, "uum_py3.11.0:otel1.20.0:ext{}".format(_utils.ext_version))
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_utils.py:829
- The test name still says
distro, but the patched environment is now empty and the assertion covers the default exporter path. This makes the test suite misleading; rename it or restore the distro-env setup so the name matches the behavior under test.
def test_get_sdk_version_distro(self, mock_python_version, mock_prefix):
0028f83 to
ef4959c
Compare
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.
Description
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines