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 1
1
import logging
2
2
from logging import Logger
3
3
4
+ from azure .identity import DefaultAzureCredential
4
5
from azure .monitor .opentelemetry .exporter import AzureMonitorTraceExporter
5
6
from fastapi import FastAPI
6
7
from fastapp .core .config import settings
@@ -35,8 +36,10 @@ def setup_tracer(app: FastAPI):
35
36
RETURNS (None): Nothing is being returned.
36
37
"""
37
38
if settings .APPLICATIONINSIGHTS_CONNECTION_STRING :
39
+ credential = DefaultAzureCredential ()
38
40
exporter = AzureMonitorTraceExporter .from_connection_string (
39
- settings .APPLICATIONINSIGHTS_CONNECTION_STRING
41
+ settings .APPLICATIONINSIGHTS_CONNECTION_STRING ,
42
+ credential = credential
40
43
)
41
44
tracer = TracerProvider (resource = Resource ({SERVICE_NAME : "api" }))
42
45
tracer .add_span_processor (BatchSpanProcessor (exporter ))
You can’t perform that action at this time.
0 commit comments