File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 11import logging
22from logging import Logger
33
4+ from azure .identity import DefaultAzureCredential
45from azure .monitor .opentelemetry .exporter import AzureMonitorTraceExporter
56from fastapi import FastAPI
67from fastapp .core .config import settings
@@ -35,8 +36,10 @@ def setup_tracer(app: FastAPI):
3536 RETURNS (None): Nothing is being returned.
3637 """
3738 if settings .APPLICATIONINSIGHTS_CONNECTION_STRING :
39+ credential = DefaultAzureCredential ()
3840 exporter = AzureMonitorTraceExporter .from_connection_string (
39- settings .APPLICATIONINSIGHTS_CONNECTION_STRING
41+ settings .APPLICATIONINSIGHTS_CONNECTION_STRING ,
42+ credential = credential
4043 )
4144 tracer = TracerProvider (resource = Resource ({SERVICE_NAME : "api" }))
4245 tracer .add_span_processor (BatchSpanProcessor (exporter ))
You can’t perform that action at this time.
0 commit comments