Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add application insights for request and backend tracing of performance data #515

Merged
merged 29 commits into from
Aug 14, 2023

Conversation

tonybaloney
Copy link
Contributor

Application Insights

This PR adds Application Insights with tracing and logging in the app using Open Telemetry

End-to-End tracing of chat requests

Admins can see the trace of any HTTP request including all backend calls to Cognitive Search and Open AI APIs.

screenshot 2023-08-09 at 09 21 36

Exceptions captured and logged

Server-side exceptions are now logged and available in the Failures page

screenshot 2023-08-09 at 09 20 38

Copy link
Collaborator

@pamelafox pamelafox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need versions pinned?

app/backend/app.py Outdated Show resolved Hide resolved
app/backend/requirements.txt Outdated Show resolved Hide resolved
app/backend/app.py Outdated Show resolved Hide resolved
infra/core/monitor/applicationinsights.bicep Show resolved Hide resolved
infra/main.bicep Outdated Show resolved Hide resolved
Co-authored-by: Pamela Fox <pamela.fox@gmail.com>
@pamelafox
Copy link
Collaborator

Please update to ASGI goodness

@pamelafox
Copy link
Collaborator

@chuwik suggests making it opt in, like a USE_OPENTELEMETRY or USE_APPINSIGHTS parameter perhaps?

@@ -55,6 +55,9 @@
},
"gptDeploymentName": {
"value": "${AZURE_OPENAI_GPT_DEPLOYMENT=davinci}"
},
"useApplicationInsights": {
"value": "${AZURE_USE_APPLICATION_INSIGHTS=false}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice the TODO templates also output the similar USE_APIM in main.bicep - am not sure when/if thats needed for this scenario: https://github.com/pamelafox/azure-dev/blob/37f88d5196a3aed4899f2928a67f43714dbff967/templates/todo/projects/csharp-sql/.repo/bicep/infra/main.bicep#L200

If you're not sure either, maybe @vhvb1989 can chime in.

Copy link
Collaborator

@pamelafox pamelafox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple questions but no clear blockers, very excited to try this out!

@tonybaloney tonybaloney merged commit 9ee22bf into Azure-Samples:main Aug 14, 2023
5 checks passed
@tonybaloney tonybaloney deleted the tracing_otel branch August 14, 2023 02:21
HughRunyan pushed a commit to RMI/RMI_chatbot that referenced this pull request Mar 26, 2024
…ce data (Azure-Samples#515)

* Example for request and backend tracing

* Add bicep for an application insights service connected to the backend

* Quart draft

* Loosen requirements

* Use the new azure package for OTEL

* Remove rich console import

* Fix ask and test

* Quart deploying now

* Use semantic

* Get tests working

* Output connection string for azure monitor. Enable instrumentation in a different order

* Revert simple

* Typing fixes

* dont use pipe

* Simplify tracing setup

* Exclude app insights from output strings

* Reorder imports

* Only configure azure monitor if environment variable is set

* Update app/backend/app.py

Co-authored-by: Pamela Fox <pamela.fox@gmail.com>

* Fix import paths for aio

* Make Application Insights optional, add documentation

* Reorder imports

* Pin versions

* Trace aiohttp calls

* reorder imports

---------

Co-authored-by: Pamela Fox <pamela.fox@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants