Explain it simpler
When an app is slow or broken, you need clues. Telemetry is the app's diary: a record of each request, each call it made to other services, each error and some useful numbers. Application Insights is the Azure service that collects and searches that diary. OpenTelemetry is a common, open language for writing it, so the same code works with many tools. For Python, Microsoft offers a ready-made package that sets everything up with one line. A connection string tells the app which Application Insights resource to send its diary to. A trace is the whole story of one request, and spans are its chapters, each with a start and end time. Custom metrics are counts you choose, like the number of tokens used.
The support lead at Quillfeather Books forwards you a complaint: the new "ask a librarian" assistant, a retrieval-augmented chatbot, sometimes takes twelve seconds to answer. You open Application Insights and find only a list of slow requests, each a single bar with no detail inside. Was it the search index? The model call? The database? Meanwhile the finance team wants to know how many model tokens the assistant burns per day, and nobody is counting. You have an afternoon. How do you make the app tell you, step by step, where its time goes and how much it uses, without rebuilding it?
Application Insights is the application performance monitoring (APM) feature of Azure Monitor. It collects requests, dependencies (outbound calls your app makes), exceptions, logs and metrics from your application and stores them in a Log Analytics workspace, where you can search them, chart them and alert on them. For Python, Microsoft's recommended way to send this telemetry is the Azure Monitor OpenTelemetry Distro, published as the azure-monitor-opentelemetry package.
Keep reading for free
Create a free StudyToCert account to read the rest of this lesson: 8 more sections, 5 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.