Skip to content

Commit b6c3775

Browse files
updated loggings
1 parent 0b31416 commit b6c3775

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

content-gen/src/backend/app.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,25 @@
4848
appinsights_connection_string = os.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING")
4949
if appinsights_connection_string:
5050
# Configure Application Insights if the connection string is found
51-
# logging_level=WARNING sends only WARNING/ERROR/CRITICAL to App Insights
52-
# (INFO traces like "Loaded product", "Uploaded image", workflow steps stay in container logs only)
5351
configure_azure_monitor(
5452
connection_string=appinsights_connection_string,
5553
enable_live_metrics=False,
5654
enable_performance_counters=False,
57-
logging_level=logging.WARNING,
5855
)
56+
# Suppress verbose Azure SDK INFO logs from App Insights
57+
# WARNING/ERROR/CRITICAL from these loggers still come through
58+
logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.WARNING)
59+
logging.getLogger("azure.monitor.opentelemetry.exporter").setLevel(logging.WARNING)
60+
logging.getLogger("azure.identity").setLevel(logging.WARNING)
61+
logging.getLogger("azure.cosmos").setLevel(logging.WARNING)
5962
# Disable Azure SDK native span creation (ContainerProxy.*, BlobClient.* InProc spans)
6063
azure_settings.tracing_implementation = None
6164
# Apply ASGI middleware for request tracing (Quart is not auto-instrumented by configure_azure_monitor)
65+
# Exclude health probes, post-deploy admin calls, and polling endpoints from telemetry
6266
app.asgi_app = OpenTelemetryMiddleware(
6367
app.asgi_app,
6468
exclude_spans=["receive", "send"],
65-
excluded_urls="api/generate/status",
69+
excluded_urls="health,api/generate/status",
6670
)
6771
logger.info("Application Insights configured with the provided connection string")
6872
else:

0 commit comments

Comments
 (0)