Application Insights Overview
Application Insights is Azure’s application performance monitoring (APM) service. While Azure Monitor covers infrastructure health, Application Insights goes inside your application — tracking every HTTP request, every database call, every exception, every custom event you choose to record. The result is a complete picture of your application’s behavior from the perspective of the code running on your infrastructure.
What Application Insights collects automatically
When you add the Application Insights SDK (or enable auto-instrumentation on Azure App Service), a range of telemetry flows automatically without writing a single monitoring-specific line of code:
| Telemetry Type | What it Captures | Log Analytics Table |
|---|---|---|
| Requests | Every inbound HTTP request: URL, method, status code, duration, success/failure | AppRequests |
| Dependencies | Outbound calls: SQL, HTTP, Redis, Azure Storage, Service Bus, Event Hubs | AppDependencies |
| Exceptions | Unhandled exceptions: type, message, stack trace, inner exception | AppExceptions |
| Traces | Log messages emitted via ILogger, Log4j, logback, or the TelemetryClient directly | AppTraces |
| Page Views | Browser page loads (via JavaScript snippet) | AppPageViews |
| Custom Events | Business events you define: OrderPlaced, UserSignedUp, PaymentProcessed | AppEvents |
| Custom Metrics | Numeric measurements you record: queue depth, processing time, cache hit rate | AppMetrics |
| Availability | Results of availability tests (URL ping, standard, custom) | AppAvailabilityResults |
| Performance Counters | CPU, memory, GC pressure, request queue length (host-level) | AppPerformanceCounters |
Creating an Application Insights resource
Application Insights resources are created as workspace-based components, linked to a Log Analytics workspace.
# Create a Log Analytics workspace first
az monitor log-analytics workspace create \
--resource-group myRG \
--workspace-name myWorkspace \
--location eastus
# Create the Application Insights component linked to the workspace
az monitor app-insights component create \
--app myapp-insights \
--location eastus \
--resource-group myRG \
--application-type web \
--workspace /subscriptions/<sub-id>/resourceGroups/myRG/providers/Microsoft.OperationalInsights/workspaces/myWorkspace
# Retrieve the connection string (used in your application)
az monitor app-insights component show \
--app myapp-insights \
--resource-group myRG \
--query connectionString \
--output tsv
# Enable Application Insights auto-instrumentation on an App Service
az webapp config appsettings set \
--resource-group myRG \
--name myapp \
--settings \
APPLICATIONINSIGHTS_CONNECTION_STRING="<connection-string>" \
ApplicationInsightsAgent_EXTENSION_VERSION="~3" \
XDT_MicrosoftApplicationInsights_Mode="Recommended"Custom events: tracking what matters to your business
Auto-collected telemetry tells you about HTTP requests and database calls. Custom events tell you about business outcomes: how many users completed onboarding, how many orders were abandoned at the cart stage, which features are being used. Custom events are the bridge between technical monitoring and business intelligence.
Custom events appear in the AppEvents table in Log Analytics and can be queried with KQL:
// How many orders were placed vs abandoned in the last 7 days?
AppEvents
| where TimeGenerated > ago(7d)
| where Name in ("OrderPlaced", "CartAbandoned", "CheckoutStarted")
| summarize EventCount = count() by Name, bin(TimeGenerated, 1d)
| render columnchart
// Funnel: what percentage of checkout starts result in a placed order?
let CheckoutStarts = toscalar(
AppEvents
| where TimeGenerated > ago(7d)
| where Name == "CheckoutStarted"
| count
);
let OrdersPlaced = toscalar(
AppEvents
| where TimeGenerated > ago(7d)
| where Name == "OrderPlaced"
| count
);
print
CheckoutStarts = CheckoutStarts,
OrdersPlaced = OrdersPlaced,
ConversionRate = round(100.0 * OrdersPlaced / CheckoutStarts, 1)
// Custom event with properties: which payment methods are used?
AppEvents
| where TimeGenerated > ago(30d)
| where Name == "OrderPlaced"
| extend PaymentMethod = tostring(customDimensions["paymentMethod"])
| summarize Orders = count() by PaymentMethod
| order by Orders descLive Metrics Stream
Live Metrics Stream is one of Application Insights’ most practically useful features during an incident or deployment. It shows a real-time, sub-second stream of incoming requests, failure rates, response times, and server performance — updated every second without any query delay.
Use Live Metrics Stream when:
- You are deploying a change and want to see immediately if error rates increase.
- You are responding to an active incident and need real-time confirmation that a fix is working.
- You are load testing and want instant feedback on how the application is responding.
- You are debugging a specific user scenario and want to watch telemetry appear in real time.
Access it from Application Insights → Live Metrics in the portal, or via the CLI:
# Open the Live Metrics Stream URL for a specific component
# (navigate in browser — it requires WebSocket connection)
az monitor app-insights component show \
--app myapp-insights \
--resource-group myRG \
--query id \
--output tsv
# Then go to: https://portal.azure.com/#@<tenant>/resource/<id>/quickpulseSmart Detection: automated anomaly alerts
Smart Detection uses machine learning to monitor your application’s telemetry and automatically detect anomalies — without you defining alert rules. It watches for:
- Abnormal rise in failure rate (based on historical baseline)
- Abnormal rise in exception volume
- Degradation in server response time
- Degradation in page load time
- Memory leak detection
- Slow database calls
- Security detection (potential security issues in dependency calls)
Smart Detection takes 7 days to establish a baseline. After that, it sends proactive notifications via email or action group when it detects something unusual.
Smart Detection is complementary to manual alert rules, not a replacement. It catches gradual degradation that a static threshold would miss (e.g., response times slowly increasing over a week), while manual alerts catch immediate, sharp changes faster.
Application Map: visualizing your service topology
Application Map is a visual representation of your application’s service topology, automatically built from the dependency telemetry Application Insights collects. It shows each service or component as a node, with lines connecting them for each type of dependency call. Nodes are colored by health: green for healthy, red for failing, yellow for degraded.
Application Map is invaluable for new team members who need to understand the system architecture, and during incidents for quickly identifying which node is the source of cascading failures across the topology.
Common mistakes
- Using a single Application Insights resource for all environments. If production, staging, and development all send telemetry to the same resource, your dashboards are polluted with test traffic and your alerts will fire from development deployments. Create one Application Insights resource per environment.
- Not setting the cloud role name. Application Map and Transaction Diagnostics use the cloud role name to identify services. Without it, all telemetry appears under the server hostname, which is meaningless in containerized environments.
- Forgetting to track custom events for business outcomes. Application Insights collects technical metrics automatically. Business metrics — conversion rates, feature adoption, order volumes — require you to call
TelemetryClient.TrackEvent()explicitly. This is not automatic. - Using classic (non-workspace-based) Application Insights resources. Classic resources are being retired. Create only workspace-based resources. They give you full KQL access, better retention control, and unified RBAC through the Log Analytics workspace.
Summary
- Application Insights automatically collects requests, dependencies, exceptions, traces, page views, and performance counters from instrumented applications.
- Workspace-based Application Insights stores all telemetry in a Log Analytics workspace, enabling full KQL access alongside all other Azure Monitor data.
- Custom events and custom metrics bridge technical monitoring with business outcome tracking.
- Live Metrics Stream provides real-time, sub-second telemetry ideal for deployments and incident response.
- Smart Detection automatically learns your application’s baseline and alerts on anomalous changes without manual threshold configuration.
Frequently asked questions
What languages does Application Insights support?
Application Insights has SDKs for .NET, Java, Node.js, Python, JavaScript, and Ruby. It also supports auto-instrumentation for Azure App Service (.NET, Java, Node.js, Python), Azure Functions, and AKS workloads.
What is a workspace-based Application Insights resource?
A workspace-based Application Insights resource stores all telemetry in a Log Analytics workspace you own, giving you full KQL query access, custom retention settings, and workspace-level RBAC. Classic (non-workspace-based) resources are being retired in 2025.
How does Application Insights affect application performance?
Application Insights is designed to have minimal overhead. The SDK typically adds less than 5ms to request processing time on average. Adaptive sampling automatically reduces telemetry volume during high load to protect application performance.