0Pricing
Cloud & IT Cert Prep · Lesson

Application Insights

Instrument a web application with the Application Insights SDK, explore the application map, and use Live Metrics Stream to diagnose issues in real time.

Application Insights is a free Cloud & IT Cert Prep lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cloud & IT Cert Prep learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

What Is Application Insights?

Application Insights is a feature of Azure Monitor that provides application performance monitoring (APM) for live web applications. It collects telemetry about requests, dependencies, exceptions, page views, and custom events. Unlike platform metrics that describe infrastructure health, Application Insights describes what your application code is doing and how end users experience it. It supports .NET, Node.js, Java, Python, and browser JavaScript.

Instrumenting Your Application

You add Application Insights to an application by installing the SDK or using auto-instrumentation (also called codeless attach). For App Service, enabling Application Insights from the portal installs the agent automatically with no code changes. For self-managed applications, you add the SDK package and provide the connection string (preferred over the older instrumentation key) from your Application Insights resource.

# Enable Application Insights on an App Service app
az webapp config appsettings set \
  --name myApp \
  --resource-group myRG \
  --settings APPLICATIONINSIGHTS_CONNECTION_STRING='InstrumentationKey=...' \
             ApplicationInsightsAgent_EXTENSION_VERSION='~3'

The Application Map

The Application Map is a visual topology of your application's components and their dependencies. Each node represents a component (your app, a downstream API, a database, or an Azure service), and the edges show call relationships annotated with average response time, request rate, and failure rate. You can click any node or edge to drill into individual request traces and identify where latency or failures originate.

Live Metrics Stream

Live Metrics Stream provides a real-time, sub-second view of your application's performance with zero latency. You can watch incoming request rates, response times, failure rates, and CPU usage as they happen — crucial during a live deployment or incident investigation. Live Metrics uses a secure outbound connection from your app to Application Insights, so no inbound firewall rule changes are needed.

Distributed Tracing and End-to-End Transactions

Distributed tracing correlates telemetry across multiple services using a shared operation_Id. When a user request enters your front-end app, Application Insights propagates trace context headers to downstream services. The End-to-End Transaction Details view assembles all spans from all participating services into a single Gantt-chart timeline, showing exactly where time is spent across your microservices architecture.

Custom Events and Metrics

Beyond automatic telemetry, you can track custom events and custom metrics using the SDK. Call trackEvent() to record business-level events like 'CheckoutCompleted' or 'FeatureFlagEnabled'. Call trackMetric() to record application-specific measurements like queue depth or cache hit ratio. Custom telemetry appears in the same Log Analytics tables and can be queried with KQL alongside platform data.

// Node.js SDK example — tracking a custom event
const appInsights = require('applicationinsights');
appInsights.defaultClient.trackEvent({
  name: 'CheckoutCompleted',
  properties: { userId: '42', plan: 'premium' },
  measurements: { orderValue: 99.99 }
});

Smart Detection and Failure Anomalies

Smart Detection automatically analyses your telemetry using machine learning and alerts you to unusual patterns — such as a sudden increase in failure rate, a degradation in server response time, or an abnormal rise in exception count. Unlike threshold alerts you configure manually, Smart Detection rules adapt to your application's normal behaviour. Alerts are sent to the subscription owners and appear in the Smart Detection blade.

Availability Tests

Availability tests (also called web tests) send synthetic HTTP requests to your application from multiple Azure regions around the world on a schedule (as frequently as every minute). They check that your public endpoints respond with the expected HTTP status code within a timeout. If a test fails from multiple locations simultaneously, an alert fires. This gives you outside-in monitoring independent of your internal infrastructure.

# Create a URL ping availability test via CLI
az monitor app-insights web-test create \
  --name 'HomepagePing' \
  --resource-group myRG \
  --app-component myAppInsightsResource \
  --defined-web-test-kind ping \
  --request-url 'https://myapp.azurewebsites.net/' \
  --locations '[{"Id":"us-ca-sjc-azr"},{"Id":"emea-gb-db3-azr"}]' \
  --frequency 300 \
  --timeout 30

Sampling to Control Data Volume

Sampling reduces the volume of telemetry sent to Application Insights by recording only a fraction of requests while preserving statistical accuracy. Adaptive sampling automatically adjusts the sample rate to stay within a target ingestion rate. Fixed-rate sampling applies a fixed percentage. Sampled telemetry is flagged so that metrics views automatically correct for the sampling factor when displaying counts and rates.

User and Session Analytics

Application Insights includes built-in usage analytics for browser-instrumented applications. The Users blade shows unique user counts, Sessions tracks user journeys, Funnels visualise drop-off through multi-step flows, and Retention charts show how many users return over time. These tools are particularly useful for product teams optimising conversion rates and user engagement alongside operational monitoring.

Application Insights and Log Analytics Tables

Application Insights data is stored in a Log Analytics workspace in dedicated tables: requests, exceptions, dependencies, traces, pageViews, customEvents, and customMetrics. When Application Insights is configured in workspace-based mode (the default for new resources), you can join these tables with other workspace data — for example correlating an application exception with a Key Vault access denial logged in AzureActivity.

// KQL — find the top 10 slowest dependencies in the last hour
dependencies
| where timestamp > ago(1h)
| where success == false or duration > 2000
| summarize AvgDuration = avg(duration), FailCount = countif(success==false)
    by name, type
| top 10 by AvgDuration desc

Quick Check

Test your understanding of Microsoft Azure Fundamentals (AZ-900) concepts from this lesson.

Lesson Recap

In this lesson you learned: Application Insights provides APM-level telemetry for request rates, failures, and dependencies, the Application Map and distributed tracing visualise your microservices topology end-to-end, and availability tests verify your public endpoints from multiple global locations. Next up we explore Azure Dashboards and Workbooks for sharing operational visibility with your team.

Frequently asked questions

Is the “Application Insights” lesson free?

Yes — the full text of “Application Insights” is free to read here on the web, and the Cloud & IT Cert Prep course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cloud & IT Cert Prep course, upgrade to CoddyKit PRO.

What will I learn in “Application Insights”?

Instrument a web application with the Application Insights SDK, explore the application map, and use Live Metrics Stream to diagnose issues in real time. You practise Cloud & IT Cert Prep with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cloud & IT Cert Prep?

No prior experience is required. Cloud & IT Cert Prep on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Application Insights” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cloud & IT Cert Prep lesson?

Yes. Every Cloud & IT Cert Prep lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Azure Monitor Metrics and Alerts
  2. Log Analytics and KQL Fundamentals
  3. Application Insights
  4. Azure Dashboards and Workbooks
← Back to Cloud & IT Cert Prep