diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md index f99bf1546ba8..ae3acb310bb9 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md @@ -7,6 +7,8 @@ ### Breaking Changes ### Bugs Fixed +- The sdkversion should only show the exporter/distro version which emits the sdkstats. Removed the AZURE_MONITOR_DISTRO_VERSION variable + ([#46963](https://github.com/Azure/azure-sdk-for-python/pull/46963)) ### Other Changes diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_constants.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_constants.py index 218340e3a13d..9135aad5ba0e 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_constants.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_constants.py @@ -23,7 +23,6 @@ _APPLICATIONINSIGHTS_METRIC_NAMESPACE_OPT_IN = "APPLICATIONINSIGHTS_METRIC_NAMESPACE_OPT_IN" # SDK version -_AZURE_MONITOR_DISTRO_VERSION = "AZURE_MONITOR_DISTRO_VERSION" _MICROSOFT_OPENTELEMETRY_VERSION = "MICROSOFT_OPENTELEMETRY_VERSION" _APPLICATIONINSIGHTS_METRICS_TO_LOGANALYTICS_ENABLED = "APPLICATIONINSIGHTS_METRICS_TO_LOGANALYTICS_ENABLED" diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py index db99edde2c7c..ba8a9da77513 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py @@ -23,7 +23,6 @@ from azure.monitor.opentelemetry.exporter._connection_string_parser import ConnectionStringParser from azure.monitor.opentelemetry.exporter._constants import ( _AKS_ARM_NAMESPACE_ID, - _AZURE_MONITOR_DISTRO_VERSION, _DEFAULT_AAD_SCOPE, _FUNCTIONS_WORKER_RUNTIME, _INSTRUMENTATIONS_BIT_MAP, @@ -120,7 +119,6 @@ def _get_sdk_version_prefix(): def _get_sdk_version(): prefix = _get_sdk_version_prefix() - distro_version = environ.get(_AZURE_MONITOR_DISTRO_VERSION) ms_otel_version = environ.get(_MICROSOFT_OPENTELEMETRY_VERSION) if ms_otel_version: return "{}py{}:otel{}:mot{}".format( @@ -129,13 +127,6 @@ def _get_sdk_version(): opentelemetry_version, ms_otel_version, ) - if distro_version: - return "{}py{}:otel{}:dst{}".format( - prefix, - platform.python_version(), - opentelemetry_version, - distro_version, - ) return "{}py{}:otel{}:ext{}".format( prefix, platform.python_version(), diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_utils.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_utils.py index d471e8bca8b5..51946fe820ba 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_utils.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_utils.py @@ -808,7 +808,6 @@ def test_is_synthetic_source_test(self): ) @patch.dict( "azure.monitor.opentelemetry.exporter._utils.environ", - {}, clear=True, ) def test_get_sdk_version_default(self, mock_python_version, mock_prefix): @@ -829,12 +828,11 @@ def test_get_sdk_version_default(self, mock_python_version, mock_prefix): ) @patch.dict( "azure.monitor.opentelemetry.exporter._utils.environ", - {"AZURE_MONITOR_DISTRO_VERSION": "1.8.8"}, 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:dst1.8.8") + self.assertEqual(result, "uum_py3.11.0:otel1.20.0:ext{}".format(_utils.ext_version)) @patch( "azure.monitor.opentelemetry.exporter._utils._get_sdk_version_prefix", @@ -872,7 +870,6 @@ def test_get_sdk_version_microsoft_opentelemetry(self, mock_python_version, mock @patch.dict( "azure.monitor.opentelemetry.exporter._utils.environ", { - "AZURE_MONITOR_DISTRO_VERSION": "1.8.8", "MICROSOFT_OPENTELEMETRY_VERSION": "2.0.0", }, clear=True,