diff --git a/sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md b/sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md index ebb60221bf37..351a2ae3fd75 100644 --- a/sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md @@ -8,6 +8,9 @@ ### Bugs Fixed +- Fix `configure_azure_monitor` options being ignored + ([#44131](https://github.com/Azure/azure-sdk-for-python/pull/44131)) + ### Other Changes ## 1.8.2 (2025-11-14) diff --git a/sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_utils/configurations.py b/sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_utils/configurations.py index 3171114af8bf..faf825c6f2da 100644 --- a/sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_utils/configurations.py +++ b/sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_utils/configurations.py @@ -164,7 +164,7 @@ def _default_sampling_ratio(configurations): default_value, e, ) - configurations[SAMPLING_TRACES_PER_SECOND_ARG] = default_value + configurations.setdefault(SAMPLING_TRACES_PER_SECOND_ARG, default_value) # Handle fixed percentage sampler elif sampler_type == FIXED_PERCENTAGE_SAMPLER: @@ -183,11 +183,11 @@ def _default_sampling_ratio(configurations): default_value, e, ) - configurations[SAMPLING_RATIO_ARG] = default_value + configurations.setdefault(SAMPLING_RATIO_ARG, default_value) # Handle all other cases (no sampler type specified or unsupported sampler type) else: - configurations[SAMPLING_RATIO_ARG] = default_value + configurations.setdefault(SAMPLING_RATIO_ARG, default_value) if sampler_type is not None: _logger.error( # pylint: disable=C "Invalid argument for the sampler to be used for tracing. "