-
Notifications
You must be signed in to change notification settings - Fork 335
/
app.py
27 lines (22 loc) · 981 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
This module contains the entry point for the application.
"""
import os
import logging
from azure.monitor.opentelemetry import configure_azure_monitor
from opentelemetry.instrumentation.httpx import HTTPXClientInstrumentor
logging.captureWarnings(True)
logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO").upper())
# Raising the azure log level to WARN as it is too verbose -
# https://github.com/Azure/azure-sdk-for-python/issues/9422
logging.getLogger("azure").setLevel(os.environ.get("LOGLEVEL_AZURE", "WARN").upper())
# We cannot use EnvHelper here as Application Insights should be configured first
# for instrumentation to work correctly
if os.getenv("APPLICATIONINSIGHTS_ENABLED", "false").lower() == "true":
configure_azure_monitor()
HTTPXClientInstrumentor().instrument() # httpx is used by openai
# pylint: disable=wrong-import-position
from create_app import create_app # noqa: E402
app = create_app()
if __name__ == "__main__":
app.run()