Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
### Bugs Fixed

### Other Changes
- Contribute distro profile information (`component="dst"` and distro version) to the OneSettings control plane during `configure_azure_monitor`
([#TBD](https://github.com/Azure/azure-sdk-for-python/pull/TBD))
- Update `azure-monitor-opentelemetry-exporter` minimum dependency to `1.0.0b56`
([#TBD](https://github.com/Azure/azure-sdk-for-python/pull/TBD))

## 1.8.9 (2026-07-01)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
_is_attach_enabled,
_is_on_functions,
)
from azure.monitor.opentelemetry.exporter._configuration._state import ( # pylint: disable=import-error,no-name-in-module
get_configuration_manager,
)
from azure.monitor.opentelemetry._diagnostics.diagnostic_logging import (
_DISTRO_DETECTS_ATTACH,
AzureDiagnosticLogging,
Expand Down Expand Up @@ -145,6 +148,17 @@ def configure_azure_monitor(**kwargs) -> None: # pylint: disable=C4758

configurations = _get_configurations(**kwargs)

# Contribute distro-level profile fields to the OneSettings control plane before any exporter is
# created. initialize() is idempotent and _ConfigurationProfile.fill() is first-wins per field, so
# setting component="dst" and the distro version here makes the profile reflect the distro; the
# exporters created below still supply ikey/region without overriding these already-set fields.
config_manager = get_configuration_manager()
if config_manager:
config_manager.initialize(
component="dst",
version=VERSION,
)

disable_tracing = configurations[DISABLE_TRACING_ARG]
disable_logging = configurations[DISABLE_LOGGING_ARG]
disable_metrics = configurations[DISABLE_METRICS_ARG]
Expand Down
2 changes: 1 addition & 1 deletion sdk/monitor/azure-monitor-opentelemetry/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
install_requires=[
"azure-core<2.0.0,>=1.28.0",
"azure-core-tracing-opentelemetry~=1.0.0b11",
"azure-monitor-opentelemetry-exporter~=1.0.0b54",
"azure-monitor-opentelemetry-exporter~=1.0.0b56",
"opentelemetry-sdk~=1.43.0",
"opentelemetry-instrumentation-django>=0.64b0,<0.65.0",
"opentelemetry-instrumentation-fastapi>=0.64b0,<0.65.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,21 @@
configure_azure_monitor,
)
from azure.monitor.opentelemetry._diagnostics.diagnostic_logging import _DISTRO_DETECTS_ATTACH

from azure.monitor.opentelemetry._version import VERSION

TEST_RESOURCE = Resource({"foo": "bar"})


# pylint: disable=too-many-public-methods
class TestConfigure(unittest.TestCase):
def setUp(self):
# Patch get_configuration_manager for every test so configure_azure_monitor never starts the
# real OneSettings worker thread. Tests that care about the interaction use
# self._get_config_manager_mock to control the returned manager.
patcher = patch("azure.monitor.opentelemetry._configure.get_configuration_manager")
self._get_config_manager_mock = patcher.start()
self.addCleanup(patcher.stop)

@patch(
"azure.monitor.opentelemetry._configure._send_attach_warning",
)
Expand Down Expand Up @@ -73,6 +81,76 @@ def test_configure_azure_monitor(
instrumentation_mock.assert_called_once()
detect_attach_mock.assert_called_once()

@patch(
"azure.monitor.opentelemetry._configure._send_attach_warning",
)
@patch(
"azure.monitor.opentelemetry._configure._setup_instrumentations",
)
@patch(
"azure.monitor.opentelemetry._configure._setup_live_metrics",
)
@patch(
"azure.monitor.opentelemetry._configure._setup_metrics",
)
@patch(
"azure.monitor.opentelemetry._configure._setup_logging",
)
@patch(
"azure.monitor.opentelemetry._configure._setup_tracing",
)
def test_configure_azure_monitor_initializes_config_manager(
self,
tracing_mock,
logging_mock,
metrics_mock,
live_metrics_mock,
instrumentation_mock,
detect_attach_mock,
):
config_manager_mock = self._get_config_manager_mock.return_value
configure_azure_monitor(connection_string="test_cs")
# Distro contributes component="dst" and its version before any exporter is created.
config_manager_mock.initialize.assert_called_once_with(
component="dst",
version=VERSION,
)

@patch(
"azure.monitor.opentelemetry._configure._send_attach_warning",
)
@patch(
"azure.monitor.opentelemetry._configure._setup_instrumentations",
)
@patch(
"azure.monitor.opentelemetry._configure._setup_live_metrics",
)
@patch(
"azure.monitor.opentelemetry._configure._setup_metrics",
)
@patch(
"azure.monitor.opentelemetry._configure._setup_logging",
)
@patch(
"azure.monitor.opentelemetry._configure._setup_tracing",
)
def test_configure_azure_monitor_config_manager_disabled(
self,
tracing_mock,
logging_mock,
metrics_mock,
live_metrics_mock,
instrumentation_mock,
detect_attach_mock,
):
# When the control plane is disabled, get_configuration_manager returns None and the distro
# skips initialize() without raising.
self._get_config_manager_mock.return_value = None
configure_azure_monitor(connection_string="test_cs")
tracing_mock.assert_called_once()
logging_mock.assert_called_once()
metrics_mock.assert_called_once()

@patch(
"azure.monitor.opentelemetry._configure._setup_instrumentations",
)
Expand Down
Loading