Skip to content

Commit

Permalink
Add logging to main app
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinbuss committed Aug 26, 2024
1 parent 3422899 commit c2b9de5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
5 changes: 5 additions & 0 deletions code/backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from botbuilder.schema import Activity, ActivityTypes
from bots.assistant import AssistantBot
from core.config import settings as CONFIG
from utils import enable_logging


# Enable logging
enable_logging()

# Create adapter.
# See https://aka.ms/about-bot-adapter to learn more about how bots work.
Expand Down
17 changes: 10 additions & 7 deletions code/backend/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def enable_logging():
# Configure azure monitor logs
configure_azure_monitor(
connection_string=settings.APPLICATIONINSIGHTS_CONNECTION_STRING,
instrumentation_options = {
instrumentation_options={
"azure_sdk": {"enabled": True},
"django": {"enabled": True},
"fastapi": {"enabled": False},
Expand All @@ -21,12 +21,14 @@ def enable_logging():
"requests": {"enabled": False},
"urllib": {"enabled": False},
"urllib3": {"enabled": False},
}
resource=Resource.create({
"service.name": settings.SERVER_NAME,
"service.namespace": settings.PROJECT_NAME,
"service.instance.id": settings.WEBSITE_INSTANCE_ID,
}),
},
resource=Resource.create(
{
"service.name": settings.SERVER_NAME,
"service.namespace": settings.PROJECT_NAME,
"service.instance.id": settings.WEBSITE_INSTANCE_ID,
}
),
logger_name=__name__,
enable_live_metrics=True,
)
Expand All @@ -44,6 +46,7 @@ def get_logger(name: str) -> logging.Logger:
logger.setLevel(settings.LOGGING_LEVEL)
return logger


def get_tracer(name: str) -> trace.Tracer:
tracer = trace.get_tracer(name)
return tracer

0 comments on commit c2b9de5

Please sign in to comment.