From 5c6eb2338a57eda9c6b1ee435722702f09ef9eb1 Mon Sep 17 00:00:00 2001 From: droideronline Date: Mon, 2 Nov 2026 23:11:49 +0530 Subject: [PATCH] Python: Clarify configure_otel_providers logging handler behavior in docstring Document that configure_otel_providers attaches its LoggingHandler to the agent_framework logger only and does not coordinate with the application's other logging handlers, and point to the manual setup sample. Also correct a comment that said root logger. --- .../packages/core/agent_framework/observability.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/python/packages/core/agent_framework/observability.py b/python/packages/core/agent_framework/observability.py index 9fec610e24..f2f28b7fa7 100644 --- a/python/packages/core/agent_framework/observability.py +++ b/python/packages/core/agent_framework/observability.py @@ -1355,7 +1355,7 @@ def _configure_providers( logger_provider = LoggerProvider(resource=resource) for log_exporter in log_exporters: logger_provider.add_log_record_processor(BatchLogRecordProcessor(log_exporter)) - # Attach a handler with the provider to the root logger + # Attach a handler with the provider to the agent_framework logger handler = LoggingHandler(logger_provider=logger_provider) logger.addHandler(handler) set_logger_provider(logger_provider) @@ -1647,6 +1647,17 @@ def configure_otel_providers( Alternatively, you can setup the providers yourself, or through another library (e.g., Azure Monitor) and just call `enable_sensitive_telemetry()` to opt-in to sensitive data capture. + Note: + This is a convenience setup for Agent Framework telemetry. It attaches an OpenTelemetry + `LoggingHandler` to the `agent_framework` logger only, and it does not inspect, coordinate with, + or make assumptions about the application's other logging handlers. For example, if the + application also attaches its own `LoggingHandler` to the root logger, `agent_framework` records + propagate to it and are exported by both handlers. Applications that combine this function with + their own logging configuration own that composition and should use manual OpenTelemetry setup + when they need custom providers, filters, propagation, or exporters. See + `python/samples/02-agents/observability/advanced_manual_setup_console_output.py` for a manual + setup example. + Note: By default, the Agent Framework emits metrics with the prefixes `agent_framework` and `gen_ai` (OpenTelemetry GenAI semantic conventions). You can use the `views`