File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import os
21import logging
2+ import os
33from azure .monitor .events .extension import track_event
44
5- logger = logging .getLogger (__name__ )
6- _telemetry_disabled_logged = False
7-
85
96def track_event_if_configured (event_name : str , event_data : dict ):
10- global _telemetry_disabled_logged
117 connection_string = os .getenv ("APPLICATIONINSIGHTS_CONNECTION_STRING" )
12- if not connection_string :
13- if not _telemetry_disabled_logged :
14- logger .warning ("Application Insights connection string is not set; telemetry events are disabled." )
15- _telemetry_disabled_logged = True
16- return
17-
18- track_event (event_name , event_data )
8+ if connection_string :
9+ track_event (event_name , event_data )
10+ else :
11+ logging .warning (f"Skipping track_event for { event_name } as Application Insights is not configured" )
You can’t perform that action at this time.
0 commit comments