Platform Metrics

Platform metrics are numeric measurements collected automatically from Azure resources at regular intervals (typically every minute). You don't install agents or write code — the moment you create a resource, Azure starts recording its metrics.

What Are Platform Metrics?

Every Azure resource type exposes a set of predefined metrics. These are time-series data points: a numeric value paired with a timestamp. For example, a Virtual Machine emits "Percentage CPU = 73.2% at 10:05:00 UTC" every 60 seconds.

Platform metrics are:

  • Automatic — No configuration needed
  • Free — Included at no extra cost
  • Retained for 93 days — Queryable via Metrics Explorer or CLI
  • Near real-time — Available within 1 minute of collection
  • Dimensional — Many metrics include dimensions (e.g., HTTP status code, instance name) for filtering

How They're Collected — Architecture

┌─────────────────────────────────────────────────┐
│              Azure Resource                     │
│  (App Service, VM, SQL, Functions, etc.)        │
│  Internal telemetry emits metrics every 60s     │
└──────────────────────┬──────────────────────────┘
                       │
                       ▼
┌─────────────────────────────────────────────────┐
│         Azure Monitor Metrics Store             │
│  • Time-series database optimized for numeric   │
│  • 93-day retention                             │
│  • Supports dimensions for filtering            │
│  • Sub-second query performance                 │
└──────────────────────┬──────────────────────────┘
                       │
          ┌────────────┼────────────┐
          ▼            ▼            ▼
    Metrics Explorer  Alerts    REST API / CLI
    (visualization)  (action)   (automation)

No diagnostic settings are needed for platform metrics — they flow automatically. This is different from resource logs, which require explicit routing.

Metrics Explorer Walkthrough (Portal)

  1. Navigate to Azure Monitor → Metrics (or open any resource → click "Metrics")
  2. Select scope — Pick the resource(s) you want to chart
  3. Select metric — Choose from the dropdown (e.g., "CPU Percentage")
  4. Select aggregation — Avg, Sum, Count, Min, or Max
  5. Adjust time range — Last hour, 24 hours, 7 days, or custom
  6. Add filters — Narrow by dimension (e.g., Instance = "instance_0")
  7. Split by dimension — Show separate lines per instance
  8. Pin to dashboard — Click the pin icon to save the chart

Key Metrics by Service

App Service

MetricWhat It Tells YouAlert Threshold Suggestion
CpuPercentageCPU usage across all instances> 80% sustained for 5 min
MemoryPercentageMemory pressure on the plan> 85% sustained for 5 min
Http5xxServer error responses> 10 in 5 minutes
HttpResponseTimeAverage response latency> 3 seconds
RequestsTotal incoming requestsUseful for traffic baselines
HealthCheckStatusHealth check endpoint results< 100% (any instance unhealthy)

Azure Functions

MetricWhat It Tells YouAlert Threshold Suggestion
FunctionExecutionCountNumber of function invocationsSpike detection (> 2x baseline)
FunctionExecutionUnitsCompute consumption (MB-ms)Budget-based threshold
DurationExecution time per invocation> 10 seconds (timeout risk)
FailuresFailed executions> 0 (any failure worth investigating)
Http5xxServer errors (HTTP-triggered)> 5 in 5 minutes

Service Bus

MetricWhat It Tells YouAlert Threshold Suggestion
ActiveMessagesMessages waiting to be processed> 1000 (consumer falling behind)
DeadLetteredMessagesMessages that failed processing> 0 (investigate immediately)
IncomingMessagesMessages arriving per intervalTraffic baseline
OutgoingMessagesMessages consumed per intervalShould track IncomingMessages
SizeQueue/topic size in bytesApproaching quota
ServerErrorsService-side failures> 0

CLI Commands to Query Metrics

# List all available metrics for an App Service
az monitor metrics list-definitions \
  --resource "/subscriptions/<sub-id>/resourceGroups/myRG/providers/Microsoft.Web/sites/myApp" \
  --output table

# Get average CPU percentage for the last hour (1-minute granularity)
az monitor metrics list \
  --resource "/subscriptions/<sub-id>/resourceGroups/myRG/providers/Microsoft.Web/serverFarms/myPlan" \
  --metric "CpuPercentage" \
  --aggregation Average \
  --interval PT1M \
  --start-time "2026-05-25T05:00:00Z" \
  --end-time "2026-05-25T06:00:00Z"

# Get HTTP 5xx count for an App Service, summed per 5 minutes
az monitor metrics list \
  --resource "/subscriptions/<sub-id>/resourceGroups/myRG/providers/Microsoft.Web/sites/myApp" \
  --metric "Http5xx" \
  --aggregation Total \
  --interval PT5M

# Get dead-lettered messages for a Service Bus queue
az monitor metrics list \
  --resource "/subscriptions/<sub-id>/resourceGroups/myRG/providers/Microsoft.ServiceBus/namespaces/myNS" \
  --metric "DeadletteredMessages" \
  --aggregation Average \
  --interval PT1M

# Query multiple metrics at once
az monitor metrics list \
  --resource "/subscriptions/<sub-id>/resourceGroups/myRG/providers/Microsoft.Web/sites/myApp" \
  --metrics "Requests" "Http5xx" "AverageResponseTime" \
  --aggregation Total Total Average \
  --interval PT5M

Metric Aggregation Types

When you view a metric, you must choose how to aggregate raw data points within each time interval:

AggregationMeaningWhen to Use
AverageMean of all values in the intervalCPU %, response time, memory %
Sum (Total)Total of all values in the intervalRequest count, error count, messages sent
CountNumber of data points in the intervalHow many samples were collected
MinimumLowest value in the intervalBest-case latency, lowest queue depth
MaximumHighest value in the intervalPeak CPU, worst-case response time

Important: Choosing the wrong aggregation gives misleading results. Average HTTP 5xx errors will show fractions (e.g., 0.4) — use Sum instead to see actual error counts.

Creating a Metric Chart and Pinning to Dashboard

In the portal:

  1. Open Metrics Explorer → configure your chart (resource, metric, aggregation)
  2. Click the pin icon (top-right of the chart)
  3. Choose an existing dashboard or create a new one
  4. The chart updates in real-time on the dashboard

Via CLI, you can create dashboards with metric tiles using ARM/Bicep templates for infrastructure-as-code approaches.

Common Mistakes

  • Using Average for count-based metrics — "Average Http5xx" across instances gives misleading decimals. Use Sum.
  • Ignoring time granularity — A 1-minute interval over 30 days returns too many points. Use PT1H for longer ranges.
  • Not splitting by dimension — Aggregate CPU looks fine at 60%, but one instance might be at 95%. Always check per-instance.
  • Confusing App Service Plan vs App Service metrics — CPU/Memory metrics live on the Plan, not the individual app.
  • Forgetting metric delays — Metrics appear within ~1 minute but not instantly. Don't panic if the latest point is missing.

Tips

  • Pin your most critical metrics (CPU, errors, queue depth) to a shared dashboard for team visibility.
  • Use metric alerts for real-time response; use log-based alerts for complex conditions.
  • Export metrics to Log Analytics (via diagnostic settings) if you need retention beyond 93 days or want to join with logs in KQL.
  • Use the "Add metric" button to overlay multiple metrics on one chart for correlation.

Key Takeaways

  • Platform metrics are free, automatic, and available for every Azure resource.
  • They're numeric time-series stored for 93 days in the Metrics Store.
  • Use Metrics Explorer in the portal for interactive charting, or the CLI for automation.
  • Choose the correct aggregation type — it fundamentally changes what the number means.
  • Key metrics vary by service: CPU/Memory for compute, message counts for messaging, error rates for web apps.
  • Split by dimension to catch per-instance problems hidden by averages.
  • Metrics are your first line of defense; logs provide the detail for root-cause analysis.