Azure Observability on Tap - End-to-End Azure Monitoring - Part 4

Analysing Metrics & Logs for Performance Tuning. Dashboards show the symptoms, but the logs and metrics tell the story. Let’s dig in and use Azure Monitor to fine-tune performance across your cloud stack.

Why Performance Tuning Matters

You’ve got visibility, alerts, and dashboards. But when things slow down, or start acting weird, you need deeper data-driven troubleshooting—not guesswork.

Azure Monitor churns through a stream of telemetry, and this post is all about turning that raw data into actionable performance insights. We’ll focus on:

  • Navigating and querying Azure Metrics
  • Using Log Analytics for correlation and hunting
  • Pinpointing performance bottlenecks before alerts fire

Metrics vs Logs: Quick Compare

Feature Metrics Logs
Granularity Near real-time Minutes to 5-minute delay
Use cases Threshold-based monitoring Root cause, correlation
Billing model Free for many common signals Pay-per-GB ingested
Format Structured time-series Semi-structured/full text

You’ll often use both together metrics raise the flag, logs explain why.

Tools You’ll Use

  • Azure Monitor Metrics Explorer
  • Log Analytics (KQL)
  • Workbooks
  • Built-in metrics + diagnostic logs on services like:
    • App Services
    • AKS
    • SQL Database
    • Application Gateway

Log Query Examples for Performance Investigation

CPU Bottleneck on VMs

1
2
3
4
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time"
| summarize avg(CounterValue) by bin(TimeGenerated, 5m), Computer
| order by avg_CounterValue desc

Web App Latency Analysis

1
2
3
4
AppRequests
| where DurationMs > 1000
| summarize SlowRequests=count() by bin(TimeGenerated, 5m), Name
| order by SlowRequests desc

App Gateway Backend Errors

1
2
3
AzureDiagnostics
| where ResourceType == "APPLICATIONGATEWAYS" and BackendStatusCode startswith "5"
| summarize count() by TimeGenerated, BackendPoolName

Pair these queries with dashboards or surface them in Workbooks for fast visibility during high load.

Metrics Deep Dive: Metrics Explorer

  1. Go to a resource (e.g. App Service)
  2. Select ➡️ Monitoring > Metrics
  3. Choose:
    • Signal (e.g. Requests, Response time, 5xx errors)
    • Time range, aggregation, and split by dimension

Pin charts directly to your dashboard or export as alert condition.

Use Case: Tuning App Service Performance

Example signals to monitor in tandem:

  • CPU Time (metric)
  • Server Errors (5xx) (metric or log)
  • Exceptions (App Insights log)
  • Outgoing dependencies (App Insights + Log Analytics)

Correlate a performance slowdown by stacking DurationMs, 5xx errors, and infrastructure metrics in the same workbook.

Bicep Add-On: Log Analytics Query Pack (Preview Feature)

Want to standardise performance queries across environments?

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
resource queryPack 'Microsoft.Insights/queryPacks@2022-10-01' = {
  name: 'standard-performance-queries'
  location: resourceGroup().location
}

resource logQuery 'Microsoft.Insights/queryPacks/queries@2022-10-01' = {
  parent: queryPack
  name: 'cpu-usage-by-vm'
  properties: {
    displayName: 'CPU usage by VM (Top Offenders)'
    description: 'Shows VMs with high average CPU usage'
    body: '''
      Perf
      | where ObjectName == "Processor" and CounterName == "% Processor Time"
      | summarize avg(CounterValue) by bin(TimeGenerated, 5m), Computer
      | order by avg_CounterValue desc
    '''
  }
}
🍺
Brewed Insight: Metrics are your heartbeat, logs are your vitals. Use both clearly, together, and you’ll spend less time trial-and-erroring your way through bad nights and more time optimising good days.

Learn More