Skip to content

Commit 5810d23

Browse files
committed
fix: Revert back to shared OTLP provider setup
The msal method does not work: It seems to miss adding the respective paths for signals (/v1/traces, etc.).
1 parent b53e884 commit 5810d23

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

msaf/agenticlayer/msaf/otel.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,21 @@
11
"""OpenTelemetry setup for a Microsoft Agent Framework Agent App."""
22

3-
import logging
4-
5-
from agent_framework.observability import configure_otel_providers
6-
from agenticlayer.shared.otel import request_hook, response_hook
7-
from opentelemetry.instrumentation.httpx import HTTPXClientInstrumentor
3+
from agent_framework.observability import enable_instrumentation
4+
from agenticlayer.shared.otel import setup_otel as _setup_otel_shared
85

96
__all__ = ["setup_otel"]
107

11-
_logger = logging.getLogger(__name__)
12-
138

149
def setup_otel() -> None:
1510
"""Set up OpenTelemetry tracing, logging and metrics for a Microsoft Agent Framework agent.
1611
17-
Uses the built-in ``agent_framework`` OTLP provider setup (reads standard
18-
``OTEL_EXPORTER_OTLP_*`` environment variables) and enables the telemetry
12+
Calls the shared OTLP provider/exporter setup (traces, logs, metrics, HTTPX
13+
instrumentation) and then enables the built-in ``agent_framework`` telemetry
1914
layers that emit ``gen_ai.client.token.usage`` and
2015
``gen_ai.client.operation.duration`` metrics.
2116
22-
Additionally instruments HTTPX clients so outgoing HTTP calls (to
23-
sub-agents, MCP servers, LLM gateways) are traced with debug-level
24-
request/response body logging.
25-
2617
Starlette server instrumentation is handled separately by
2718
:func:`agenticlayer.shared.otel_starlette.instrument_starlette_app`.
2819
"""
29-
# Set log level for urllib to WARNING to reduce noise
30-
logging.getLogger("urllib3").setLevel(logging.WARNING)
31-
32-
configure_otel_providers()
33-
34-
HTTPXClientInstrumentor().instrument(
35-
request_hook=request_hook,
36-
response_hook=response_hook,
37-
)
20+
_setup_otel_shared()
21+
enable_instrumentation()

0 commit comments

Comments
 (0)