Application Insights overview
Application Insights is an extension of Azure Monitor and provides application performance monitoring (APM) features. APM tools are useful to monitor applications from development, through test, and into production in the following ways:
- Proactively understand how an application is performing.
- Reactively review application execution data to determine the cause of an incident.
Along with collecting metrics and application telemetry data, which describe application activities and health, you can use Application Insights to collect and store application trace logging data.
The log trace is associated with other telemetry to give a detailed view of the activity. Adding trace logging to existing apps only requires providing a destination for the logs. You rarely need to change the logging framework.
Application Insights provides other features including, but not limited to:
- Live Metrics: Observe activity from your deployed application in real time with no effect on the host environment.
- Availability: Also known as synthetic transaction monitoring. Probe the external endpoints of your applications to test the overall availability and responsiveness over time.
- GitHub or Azure DevOps integration: Create GitHub or Azure DevOps work items in the context of Application Insights data.
- Usage: Understand which features are popular with users and how users interact and use your application.
- Smart detection: Detect failures and anomalies automatically through proactive telemetry analysis.
Application Insights supports distributed tracing, which is also known as distributed component correlation. This feature allows searching for and visualizing an end-to-end flow of a specific execution or transaction. The ability to trace activity from end to end is important for applications that were built as distributed components or microservices.
The Application Map allows a high-level, top-down view of the application architecture and at-a-glance visual references to component health and responsiveness.
To understand the number of Application Insights resources required to cover your application or components across environments, see the Application Insights deployment planning guide.
Firewall settings must be adjusted for data to reach ingestion endpoints. For more information, see IP addresses used by Azure Monitor.
How do I use Application Insights?
Application Insights is enabled through either autoinstrumentation (agent) or by adding the Application Insights SDK or Azure Monitor OpenTelemetry Distro to your application code. Many languages are supported. The applications could be on Azure, on-premises, or hosted by another cloud. To figure out which type of instrumentation is best for you, see How do I instrument an application?.
The Application Insights agent or SDK preprocesses telemetry and metrics before sending the data to Azure. Then it's ingested and processed further before it's stored in Azure Monitor Logs (Log Analytics). For this reason, an Azure account is required to use Application Insights.
The easiest way to get started consuming Application insights is through the Azure portal and the built-in visual experiences. Advanced users can query the underlying data directly to build custom visualizations through Azure Monitor dashboards and workbooks.
Consider starting with the Application Map for a high-level view. Use the Search experience to quickly narrow down telemetry and data by type and date-time. Or you can search within data (for example, with Log Traces) and filter to a given correlated operation of interest.
Two views are especially useful:
- Performance view: Get deep insights into how your application or API and downstream dependencies are performing. You can also find a representative sample to explore end to end.
- Failures view: Understand which components or actions are generating failures and triage errors and exceptions. The built-in views are helpful to track application health proactively and for reactive root-cause analysis.
Create Azure Monitor alerts to signal potential issues in case your application or components parts deviate from the established baseline.
Application Insights pricing is based on consumption. You only pay for what you use. For more information on pricing, see:
How do I instrument an application?
Autoinstrumentation is the preferred instrumentation method. It requires no developer investment and eliminates future overhead related to updating the SDK. It's also the only way to instrument an application in which you don't have access to the source code.
You only need to install the Application Insights SDK if:
- You require custom events and metrics.
- You require control over the flow of telemetry.
- Autoinstrumentation isn't available, typically because of language or platform limitations.
To use the SDK, you install a small instrumentation package in your app and then instrument the web app, any background components, and JavaScript within the webpages. The app and its components don't have to be hosted in Azure.
The instrumentation monitors your app and directs the telemetry data to an Application Insights resource by using a unique token. The effect on your app's performance is small. Tracking calls are nonblocking and batched to be sent in a separate thread.
Integrated autoinstrumentation is available for Azure App Service .NET, Azure App Service .NET Core, Azure Functions, and Azure Virtual Machines.
The Azure Monitor Application Insights agent is available for workloads running in on-premises virtual machines.
For a detailed view of all autoinstrumentation supported environments, languages, and resource providers, see What is autoinstrumentation for Azure Monitor Application Insights?.
For other scenarios, the Application Insights SDK is required.
An OpenTelemetry offering is also available.
Supported languages
This section outlines supported scenarios.
Supported platforms and frameworks
This section lists all supported platforms and frameworks.
Azure service integration (portal enablement, Azure Resource Manager deployments)
- Azure Virtual Machines and Azure Virtual Machine Scale Sets
- Azure App Service
- Azure Functions
- Azure Spring Apps
- Azure Cloud Services, including both web and worker roles
Autoinstrumentation (enable without code changes)
Manual instrumentation/SDK (some code changes required)
Note
OpenTelemetry-based instrumentation is available for C#, Node.js, and Python. Review the limitations noted at the beginning of each language's official documentation. If you require a full-feature experience, use the existing Application Insights SDKs.
Logging frameworks
- ILogger
- Log4Net, NLog, or System.Diagnostics.Trace
- Log4J, Logback, or java.util.logging
- LogStash plug-in
- Azure Monitor
Export and data analysis
Unsupported SDKs
Several other community-supported Application Insights SDKs exist. Azure Monitor only provides support when you use the supported instrumentation options listed in this article.
We're constantly assessing opportunities to expand our support for other languages. For the latest SDK news, see Azure updates for Application Insights.
Frequently asked questions
This section provides answers to common questions.
What telemetry does Application Insights collect?
From server web apps:
- HTTP requests.
- Dependencies. Calls to SQL databases, HTTP calls to external services, Azure Cosmos DB, Azure Table Storage, Azure Blob Storage, and Azure Queue Storage.
- Exceptions and stack traces.
- Performance counters: If you use the Azure Monitor Application Insights agent, Azure monitoring for VMs or virtual machine scale sets, or the Application Insights collectd writer.
- Custom events and metrics that you code.
- Trace logs if you configure the appropriate collector.
From client webpages:
Uncaught exceptions in your app, including information on
- Stack trace
- Exception details and message accompanying the error
- Line & column number of error
- URL where error was raised
Network Dependency Requests made by your app XHR and Fetch (fetch collection is disabled by default) requests, include information on:
- Url of dependency source
- Command & Method used to request the dependency
- Duration of the request
- Result code and success status of the request
- ID (if any) of user making the request
- Correlation context (if any) where request is made
User information (for example, Location, network, IP)
Device information (for example, Browser, OS, version, language, model)
Session information
Note
For some applications, such as single-page applications (SPAs), the duration may not be recorded and will default to 0.
For more information, see Data collection, retention, and storage in Application Insights.
From other sources, if you configure them:
How can I manage Application Insights resources with PowerShell?
You can write PowerShell scripts by using Azure Resource Monitor to:
- Create and update Application Insights resources.
- Set the pricing plan.
- Get the instrumentation key.
- Add a metric alert.
- Add an availability test.
You can't set up a metrics explorer report or set up continuous export.
How can I query Application Insights telemetery?
Use the REST API to run Log Analytics queries.
Can I send telemetry to the Application Insights portal?
We recommend that you use our SDKs and use the SDK API. There are variants of the SDK for various platforms. These SDKs handle processes like buffering, compression, throttling, and retries. However, the ingestion schema and endpoint protocol are public.
How long does it take for telemetry to be collected?
Most Application Insights data has a latency of under 5 minutes. Some data can take longer, which is typical for larger log files. See the Application Insights service-level agreement.
Troubleshooting
Review dedicated troubleshooting articles for Application Insights.
Help and support
Azure technical support
For Azure support issues, open an Azure support ticket.
Microsoft Q&A questions forum
Post general questions to the Microsoft Q&A answers forum.
Stack Overflow
Post coding questions to Stack Overflow by using an Application Insights tag.
Feedback Community
Leave product feedback for the engineering team in the Feedback Community.
Next steps
Feedback
Submit and view feedback for