How do you know if your software is actually working well for users right now, not just last week? Without an instrumentation strategy, you are flying blind — you only find out about a problem when a customer calls to complain. This chapter shows you how to design a system that watches every part of your application, collects meaningful data, and alerts you before a small issue becomes a disaster.
Jump to a section
A simple way to picture Designing and Implementing Instrumentation Strategy
Because a kitchen runs dozens of orders at once, a single burnt steak or a slow prep station can ruin a whole dinner service, which leads to customer complaints and lost revenue.
Think of your software application as a busy restaurant kitchen. The chefs (your code) are cooking orders (user requests). The head chef (you, the DevOps engineer) cannot stand at every single station all night. You need a way to know, from across the room, that the fryer oil is at the right temperature, that the grill station is running out of clean plates, and that the dessert station is falling behind on orders. This is your instrumentation strategy.
You install a central dashboard on the wall that shows live data. A green light means the grill is within perfect temperature range (a healthy API endpoint). A yellow light means the plate stack is getting low (a database nearing its capacity). A red flashing alert means the walk-in cooler door is open (a critical server failure). You set up a buzzer to sound if the ticket printer jams for more than 30 seconds (a performance alert). You also record every single order's timing to see if the wait time increases during a rush (application performance monitoring). This dashboard and alert system is your entire instrumentation strategy: collecting, aggregating, and reacting to signals from every part of the system to keep the service running smoothly.
An instrumentation strategy is the plan for how you will collect, store, analyse, and act on data about your application's health and performance. It is the difference between knowing your website is down because 10,000 people just emailed you, and knowing it is down because your monitoring system sent an alert two seconds after the server crashed.
Let's break down the core components you need to understand.
First, you have logs. A log is a time-stamped record of a single event that happened in your system. When a user logs in, your application writes a log entry: "User bob@example.com logged in at 14:32:01." When a database query fails, you get a log entry: "ERROR: Connection to database timed out." Logs are the raw, detailed story of everything that happens. They are brilliant for debugging a specific problem but overwhelming if you just want to know if everything is okay.
Second, you have metrics. A metric is a numeric measurement taken at a regular interval. For example, "CPU usage is 72%" or "The number of active user sessions is 1,403." Metrics are aggregated over time. You might track the *average* CPU usage over the last five minutes, or the *95th percentile* of request latency. Metrics give you the big picture trends. They are less detailed than logs but much better for spotting problems early.
Third, you have traces. A trace tracks a single request as it travels through all the different services in your system. Imagine a user clicks "Buy Now" on your website. That request might hit a web server, then a payment service, then an inventory database, then an email service. A trace captures how long each step took. If the payment service is slow, the trace shows you exactly where the bottleneck is. Traces are essential for modern cloud applications built from many microservices.
These three things together — logs, metrics, and traces — are often called the three pillars of observability. Your instrumentation strategy must cover all three.
Now, where does this data go? You need a central place to collect and analyse it. This is usually a monitoring platform like Azure Monitor, which is Microsoft's primary service for this on Azure. Azure Monitor ingests logs, metrics, and traces from your applications and Azure resources. It stores them and lets you query them with a language called Kusto Query Language (KQL). KQL lets you ask questions like "Show me all requests from users in London that took longer than three seconds in the last hour."
Designing the strategy means deciding:
What metrics are critical to watch? Common ones include CPU, memory, disk I/O, network traffic, request rate, error rate, and request duration.
What logs should you capture? A good rule is to log every significant state change in your application — user logins, database writes, errors, security events.
How will you alert? You configure alert rules that say, "If error rate exceeds 5% for five minutes, send an email to the on-call engineer." Alerts can trigger automated actions too, like restarting a service.
How long will you keep the data? You might keep detailed logs for 30 days for debugging, and summarised metrics for a year for trend analysis.
An instrumentation strategy replaces guesswork and manual checking. Before modern monitoring, IT staff would have to manually log into servers and run commands to see if they were healthy. That does not scale. With a good strategy, you get a live dashboard showing your entire system's health, with automatic alerts when something looks wrong.
Why does this exist? Because modern applications are distributed, running across dozens of servers, containers, and cloud services. A user's request touches many moving parts. Without instrumentation, when something breaks, you have no idea which part failed. You waste hours hunting through server logs manually. Instrumentation gives you a map and a flashlight.
For AZ-400, you need to know the specific Azure services and tools that implement this strategy. The core service is Azure Monitor. Inside Azure Monitor, you use Log Analytics Workspaces to store and query logs. You use Application Insights for application performance monitoring (APM) — it automatically captures traces, dependency calls, and user behaviour from your app code. You use Azure Dashboards to visualise metrics. And you use Azure Alerts to define rules that notify you when something goes wrong.
Identify critical user journeys and system components
Map out the most important paths through your application — for example, user login, product search, checkout. Also list every Azure resource involved (web apps, databases, functions). This determines what you must instrument.
Define the metrics and logs for each component
Decide which metrics (CPU, memory, request rate, error rate) and which log events (user sign-ups, database queries, authentication failures) are meaningful. Does every resource need CPU monitoring? Yes. Does every resource need full HTTP request logging? Probably not.
Configure diagnostic settings for each Azure resource
For each resource like a virtual machine or web app, enable diagnostic settings to send logs and metrics to a Log Analytics Workspace. Without this, Azure Monitor receives nothing from that resource.
Instrument your application code with an SDK
Add the Application Insights SDK to your application code to capture traces, custom events, and dependency calls. This gives you deep code-level visibility. For .NET, you add the NuGet package; for Python, the OpenCensus SDK.
Design and implement alert rules and action groups
Create alert rules that specify conditions (e.g., 'error rate > 5% for 5 minutes'). Link each rule to an action group that defines who gets notified (email, SMS) and what automated action runs (restart a VM, invoke a webhook). Test each alert to ensure it fires correctly.
Build and publish dashboards for the operations team
Use Azure Dashboards to create visual summaries of key metrics and logs. Pin charts, metric graphs, and query results to a single pane. Share the dashboard with your team so everyone has a common view of system health.
Imagine you work for an e-commerce company called "ShopFast." Your website sells electronics, and you just launched a big marketing campaign. Traffic is ten times higher than normal. Without a proper instrumentation strategy, here is what would happen and how you would fix it step-by-step.
First, you are on call at 2:00 AM. Your phone buzzes. It is an alert from Azure Monitor saying the checkout page error rate has spiked to 25% in the last three minutes. You open the Azure Monitor dashboard on your laptop. You see a live chart showing requests per second (a metric) and a spike in 500 HTTP errors (another metric).
Second, you click into the alert to see the associated logs. You run a KQL query in Log Analytics:
traces
| where timestamp > ago(10m)
| where severity == "Error"
| project timestamp, message, cloud_RoleInstanceYou see a log repeating every few seconds: "Database connection pool exhausted." That tells you the database server cannot handle the current load of connections.
Third, you open Application Insights. You look at the Live Metrics stream for your web app. You see that requests are queuing up and timing out. You use the Application Map feature, which visualises all your services and their dependencies. You can see clearly that the red line between your web app and your SQL database is pulsing red. This is a trace-level view.
Fourth, you decide the database is overloaded. Your instrumentation strategy already includes a metric for database CPU usage. You check that metric and see it is at 98%. You also have an automated action configured: an alert rule that, when database CPU passes 90% for five minutes, triggers an Azure Automation Runbook that scales the database to a higher tier. But your budget for auto-scaling is limited, so instead, you manually add a read replica.
Fifth, after scaling the database, you watch the dashboards. The error rate drops back to below 1% within two minutes. You write a post-mortem report. You use the data from your logs to show exactly what happened and how fast you responded.
What did you actually use in your instrumentation strategy? - Logs from Azure Monitor to pinpoint the error message. - Metrics (CPU, error rate, request rate) to see the trend and impact. - Traces from Application Insights to see the dependency chain. - Alerts to wake you up. - Dashboards to visualise everything in real-time.
This is not theory. This is the daily life of an Azure DevOps engineer. You design the strategy, set up the alerts, write the KQL queries, build the dashboards, and then rely on them when things go wrong.
AZ-400 tests your ability to *design* and *implement* this strategy, not just to use the tools. Expect multiple-choice and case study questions that present a scenario and ask you to choose the correct monitoring service or the right way to configure an alert.
The exam loves to test your understanding of the three pillars and which Azure service maps to each. You will see questions like:
"You need to collect custom performance counters from your on-premises servers and send them to Azure for analysis. Which service should you use?" (Answer: Azure Monitor with the Log Analytics agent.)
"You are diagnosing a slow API call. You need to see how long each step in the distributed call chain takes. Which tool should you use?" (Answer: Application Insights distributed tracing.)
Common traps the exam sets:
Confusing Azure Monitor with Application Insights. Azure Monitor is the umbrella service. Application Insights is the specific feature inside it for application performance monitoring (APM). Questions will give you details about code-level tracing or browser-side monitoring and expect you to pick Application Insights, not just Azure Monitor.
Forgetting about Log Analytics Workspaces. Every log and metric from Azure Monitor is stored in a Log Analytics Workspace. You need to know that you configure data retention, access control, and pricing per workspace. A question might ask: "Where should you set up role-based access control for your log data?" Answer: at the Log Analytics Workspace level.
Mixing up metric alerts and log alerts. Metric alerts fire based on a numeric threshold (e.g., CPU > 80%). Log alerts fire based on the results of a KQL query (e.g., "Count of error events > 10 in 5 minutes"). The exam will present a scenario and ask which type of alert rule to create.
Traps with auto-escalation and action groups. An Action Group is a collection of notifications (email, SMS, webhook) and actions (run an Automation Runbook, trigger a webhook). The exam expects you to know that Action Groups are reusable across multiple alert rules. A question might offer several steps to configure an alert and ask which step is missing.
Key definitions to memorise:
Azure Monitor: The central platform for monitoring Azure resources.
Log Analytics Workspace: The storage container for log data.
Application Insights: A feature of Azure Monitor for application performance monitoring (APM).
Kusto Query Language (KQL): The read-only query language used to analyse data in Log Analytics.
Metric: A numerical value collected at regular intervals.
Log: A time-stamped record of an event.
Trace: A record of a request's path through distributed services.
Action Group: A set of notification and action preferences used by Azure Monitor alerts.
Alert Rule: A condition that triggers a notification or action when met.
Diagnostic Settings: Configuration that streams resource logs and metrics to different destinations (Log Analytics Workspace, Event Hub, Storage Account).
The exam also tests your understanding of retention and archiving. You might be asked: "You need to keep audit logs for three years for compliance, but you only need quick access to the last 30 days." The answer involves configuring a Log Analytics Workspace with 30-day retention and exporting older logs to Azure Storage (cheap cold storage).
An instrumentation strategy is your plan for collecting logs, metrics, and traces to know the health of your system in real time.
Azure Monitor is the central platform; Application Insights is the feature inside it for application performance monitoring.
You must distinguish between logs (detailed events), metrics (numeric trends), and traces (request pathways) — the three pillars of observability.
Alerts should be specific and actionable; use metric alerts for thresholds and log alerts for complex patterns in KQL queries.
Log Analytics Workspaces store all monitoring data; configure retention and access control per workspace.
Action Groups enable you to reuse notification settings (email, SMS, webhook) across multiple alert rules.
Diagnostic Settings stream resource logs and metrics to destinations like Log Analytics, Event Hubs, or Storage for archiving.
Instrumentation replaces manual server checking and allows you to detect and fix issues before users are affected.
These come up on the exam all the time. Here's how to tell them apart.
Log Analytics Workspace
Centralised storage for all monitoring data from multiple resources
Used for infrastructure logs, metrics, and custom log sources
Queried using Kusto Query Language (KQL)
Application Insights
Focused on application code-level performance and user behaviour
Automatically captures traces, dependency calls, and page views
Includes features like Live Metrics, Application Map, and Smart Detection
Metric Alert
Triggers based on a numeric threshold (e.g., CPU > 90%)
Evaluated at regular intervals (e.g., every 1 minute)
Low latency, ideal for real-time infrastructure monitoring
Log Alert
Triggers based on results of a KQL query (e.g., count of errors > 10)
Evaluated each time logs are ingested
Higher latency but supports complex logic across multiple log sources
Diagnostic Settings
Configured on Azure resources to send platform logs and metrics
No code change required — works at the Azure infrastructure layer
Sends data to Log Analytics Workspace, Event Hub, or Storage
Application Insights SDK
Added to application source code to collect custom events and traces
Requires code modification and redeployment
Provides deep code-level insight (dependencies, exceptions, page views)
Kusto Query Language (KQL)
Read-only query language designed for big data log analysis
Uses a pipeline operator (|) to chain commands
Native to Azure Data Explorer and Azure Monitor
SQL
General-purpose query language for relational databases
Uses SELECT, FROM, WHERE clauses
Designed for transactional and structured data
Mistake
Instrumentation means just installing a monitoring tool like Azure Monitor and it works automatically.
Correct
Instrumentation is a design process. You must decide what to measure, how to collect it, and what alerts to create. The tool does nothing useful without a strategy and configuration.
People see Azure Monitor as a one-click solution. In reality, you must write instrumentation code, configure diagnostic settings, define custom metrics, and build queries to get value.
Mistake
Logs and metrics are the same thing, just stored differently.
Correct
Logs are detailed event records, metrics are numeric measurements aggregated over time. They serve different purposes: logs for deep debugging, metrics for trend spotting and alerting.
Both appear in Azure Monitor side by side, so beginners assume they are interchangeable. But you cannot query logs for real-time CPU averages, and you cannot get stack traces from a metric.
Mistake
If I enable Application Insights, I do not need any other monitoring.
Correct
Application Insights monitors your application code. You still need Azure Monitor to watch Azure infrastructure (VM CPU, database throughput, network packets). You need both.
The name 'Application Insights' sounds comprehensive, but it is part of the Azure Monitor ecosystem. Beginners think it replaces infrastructure monitoring, but it does not.
Mistake
Alerts should be set to fire on any deviation from normal.
Correct
Alerts should only fire on actionable conditions. If every small spike triggers an alert, engineers get alert fatigue and ignore real problems. Good design tunes alert thresholds carefully.
Instrumentation beginners assume 'more alerts' equals 'more safety.' In practice, noisy alerts are ignored, so real outages get missed.
Mistake
You must store all logs forever for compliance.
Correct
You should define a retention policy based on compliance requirements. Logs older than the policy can be archived to cheap storage or deleted. Storing everything forever is expensive and unnecessary.
Compliance fear drives beginners to keep everything. But Azure Monitor charges per GB ingested and retained. Over-retention drives up costs without benefit.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
Azure Monitor is the overall monitoring platform for Azure resources. Application Insights is a specific feature inside Azure Monitor for application performance monitoring (APM), focusing on code-level tracing and user behaviour.
Yes, for Azure virtual machines you need to install the Log Analytics agent (or the newer Azure Monitor agent) on each VM. The agent collects logs and performance counters and sends them to your Log Analytics Workspace.
KQL is the query language used to analyse data in Azure Monitor Log Analytics. You write KQL queries to filter logs, calculate metrics, and find specific events. The AZ-400 exam expects you to recognise basic KQL syntax.
It depends on your compliance requirements. A common pattern is 30-90 days of interactive retention in Log Analytics, then export older logs to Azure Storage for cheap archival. You configure retention in the Log Analytics Workspace settings.
An action group defines how to respond when an alert fires: who to notify (email, SMS, push notification) and what automated actions to run (webhook, Azure Automation runbook, ITSM connector). You reuse action groups across multiple alert rules.
Yes. You can install the Log Analytics agent on on-premises Windows and Linux servers. They will send data to your Azure Log Analytics Workspace, giving you a single monitoring pane for hybrid environments.
You've finished Designing and Implementing Instrumentation Strategy. Continue through the AZ-400 study guide to build a complete picture of the exam.
Done with this chapter?