diff --git a/app/helpers/monitoring.py b/app/helpers/monitoring.py index 22e487d..2114cb3 100644 --- a/app/helpers/monitoring.py +++ b/app/helpers/monitoring.py @@ -9,10 +9,12 @@ # Azure Application Insights APPINSIGHTS_CONNECTION_STRING = env.get("APPLICATIONINSIGHTS_CONNECTION_STRING", None) -if not APPINSIGHTS_CONNECTION_STRING: - raise ValueError("APPLICATIONINSIGHTS_CONNECTION_STRING is not set") -# OpenTelemetry -configure_azure_monitor() # Configure Azure Application Insights exporter -AioHttpClientInstrumentor().instrument() # Instrument aiohttp -HTTPXClientInstrumentor().instrument() # Instrument httpx +if not APPINSIGHTS_CONNECTION_STRING: + # We don't raise an error, that feature must be optional + print("Azure Application Insights monitoring is disabled, set APPLICATIONINSIGHTS_CONNECTION_STRING to enable.") +else: + # OpenTelemetry + configure_azure_monitor() # Configure Azure Application Insights exporter + AioHttpClientInstrumentor().instrument() # Instrument aiohttp + HTTPXClientInstrumentor().instrument() # Instrument httpx