Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Azure Monitor Metrics is a feature of Azure Monitor that collects numeric data from monitored resources into a time-series database. Metrics are numerical values that are collected at regular intervals and describe some aspect of a system at a particular time.
Note
Azure Monitor Metrics is one half of the data platform that supports Azure Monitor. The other half is Azure Monitor Logs, which collects and organizes log and performance data. You can analyze that data by using a rich query language.
Metric implementations
Azure Monitor supports multiple metric implementations that are optimized for different sources, collection methods, and analysis tools:
- Platform metrics are collected automatically from Azure resources. They require no configuration and have no ingestion or storage cost.
- Advanced platform metrics extend platform metrics with deeper, more granular data for supported resource providers. You explicitly opt in to these paid metrics at the resource level. Advanced platform metrics are currently in public preview.
- Metrics in an Azure Monitor workspace include Prometheus and OpenTelemetry metrics from Kubernetes clusters, virtual machines, Arc-enabled servers, applications, and other sources. OpenTelemetry ingestion is in preview. Use PromQL to analyze these metrics and Grafana to visualize them.
Note
Native custom metrics remain available in public preview for existing implementations, but they won't become generally available. For new solutions, use the OpenTelemetry-based path described in Custom metrics in Azure Monitor.
The differences between each of the metrics are summarized in the following table.
| Category | Platform metrics | Advanced platform metrics | Metrics in Azure Monitor workspace |
|---|---|---|---|
| Sources | Azure resources | Supported Azure resources | Kubernetes clusters, virtual machines, Arc-enabled servers, instrumented applications, and other OpenTelemetry sources |
| Configuration | None | Opt in at the resource level | Configure an Azure Monitor workspace and a Prometheus or OpenTelemetry collection pipeline |
| Storage | Azure subscription | Azure subscription | Azure Monitor workspace |
| Cost | No ingestion or storage charge | Paid | Paid |
| Aggregation | Preaggregated | Preaggregated | Raw time-series data |
| Analyze | Metrics explorer | Metrics explorer | PromQL |
| Alert | Metric alert rules | Metric alert rules | Query-based metric alert rules (preview) and Prometheus alert rules |
| Visualize | Metrics explorer, Workbooks, Azure dashboards, and Grafana | Metrics explorer, Workbooks, Azure dashboards, and Grafana | Dashboards with Grafana, Azure Managed Grafana, and Workbooks |
| Retrieve | Azure Monitor Metrics data plane APIs, client libraries, and command-line tools | Azure Monitor Metrics data plane APIs, client libraries, and command-line tools | Prometheus HTTP API |
Use the following client libraries and command-line tools to retrieve platform and advanced platform metrics:
- Azure CLI
- Azure PowerShell cmdlets
- REST API or client library
- .NET
- Go
- Java
- JavaScript
- Python
Data collection
Azure Monitor collects metrics from the following sources. After these metrics are collected in the Azure Monitor metric database, they can be evaluated together regardless of their source:
- Azure resources: Azure resources create platform metrics that give you visibility into their health and performance. Each type of resource creates a distinct set of metrics without any configuration required. Azure Monitor collects platform metrics from Azure resources at a one-minute frequency unless the metric's definition specifies otherwise.
- Applications: Application Insights creates metrics for your monitored applications to help you detect performance issues and track trends in how your application is being used. In preview, applications can also send OpenTelemetry metrics to an Azure Monitor workspace by using OpenTelemetry Protocol ingestion.
- Virtual machines and Arc-enabled servers: In preview, Azure Monitor Agent can receive OpenTelemetry Protocol metrics from applications and forward them to an Azure Monitor workspace. Azure Monitor Agent also collects OpenTelemetry system metrics from the guest operating system.
- Kubernetes clusters: Azure Monitor managed service for Prometheus scrapes Prometheus metrics from Kubernetes clusters and stores them in an Azure Monitor workspace. For the metrics scraped by default, see Default Prometheus metrics configuration.
- Other OpenTelemetry sources: In preview, an open-source OpenTelemetry Collector can send metrics directly to Azure Monitor ingestion endpoints. For configuration options, see Ingest OpenTelemetry Protocol signals into Azure Monitor.
Note
Metrics from different sources and collection methods might use different aggregations. For example, platform metrics are pre-aggregated and stored in a time-series database, while Prometheus metrics are stored as raw data. Resource metrics might also have a different latency than other metrics. Differences in aggregation and latency can lead to different metric values for a specific sample time. Over time when latency ceases to be an issue, and when analyzing the metrics at the same time granularity, these differences disappear. For specific latency expectations for platform metrics exported via diagnostic settings, see Log data ingestion time in Azure Monitor.
Data plane APIs
Azure Monitor provides REST APIs that allow you to get data in and out of Azure Monitor Metrics.
- Custom metrics API - Custom metrics allow you to load your own metrics into the Azure Monitor Metrics database. The same analysis tools that process Azure Monitor platform metrics can then use those metrics.
- Azure Monitor Metrics REST API - Allows you to access Azure Monitor platform metrics definitions and values. For more information, see Azure Monitor REST API. For information on how to use the API, see the Azure monitoring REST API walkthrough.
- Azure Monitor Metrics Batch REST API - Azure Monitor Metrics Batch API is a high-volume API designed for customers with large volume metrics queries. It's similar to the existing standard Azure Monitor Metrics REST API, but provides the capability to retrieve metric data for up to 50 resource IDs in the same subscription and region in a single batch API call. This improves query throughput and reduces the risk of throttling.
Security
All communication between connected systems and the Azure Monitor service is encrypted using the TLS 1.2 (HTTPS) protocol. The Microsoft SDL process is followed to ensure all Azure services are up-to-date with the most recent advances in cryptographic protocols.
Secure connection is established between the agent and the Azure Monitor service using certificate-based authentication and TLS with port 443. Azure Monitor uses a secret store to generate and maintain keys. Private keys are rotated every 90 days and are stored in Azure and are managed by the Azure operations who follow strict regulatory and compliance practices. For more information on security, see Encryption of data in transit, Encryption of data at rest, and Azure Monitor security overview and guidelines.
Metrics explorer
Use Metrics explorer to interactively analyze the data in your metric database and chart the values of multiple metrics over time. Pin the charts to a dashboard to view them with other visualizations. Retrieve metrics by using the Azure monitoring REST API.
For more information, see Analyze metrics with Azure Monitor metrics explorer.
Data structure
Data that Azure Monitor Metrics collects, is stored in a time-series database that's optimized for analyzing time-stamped data. Each set of metric values is a time series with the following properties:
- The time when the value was collected.
- The resource that the value is associated with.
- A namespace that acts like a category for the metric.
- A metric name.
- The value itself.
- Multiple dimensions when they're present. Dimension limits depend on the metric implementation.
Multi-dimensional metrics
One of the challenges to metric data is that it often has limited information to provide context for collected values. Azure Monitor addresses this challenge with multi-dimensional metrics.
Metric dimensions are name/value pairs that carry more data to describe the metric value. For example, a metric called Available disk space might have a dimension called Drive with values C: and D:. That dimension would allow viewing available disk space across all drives or for each drive individually.
See Apply dimension filters and splitting for details on viewing metric dimensions in metrics explorer.
Nondimensional metric
The following table shows sample data from a nondimensional metric, network throughput. It can only answer a basic question like "What was my network throughput at a given time?"
| Timestamp | Metric value |
|---|---|
| 8/9/2017 8:14 | 1,331.8 Kbps |
| 8/9/2017 8:15 | 1,141.4 Kbps |
| 8/9/2017 8:16 | 1,110.2 Kbps |
Network throughput and two dimensions ("IP" and "Direction")
The following table shows sample data from a multidimensional metric, network throughput with two dimensions called IP and Direction. It can answer questions such as "What was the network throughput for each IP address?" and "How much data was sent versus received?"
| Timestamp | Dimension "IP" | Dimension "Direction" | Metric value |
|---|---|---|---|
| 8/9/2017 8:14 | IP="192.168.5.2" | Direction="Send" | 646.5 Kbps |
| 8/9/2017 8:14 | IP="192.168.5.2" | Direction="Receive" | 420.1 Kbps |
| 8/9/2017 8:14 | IP="10.24.2.15" | Direction="Send" | 150.0 Kbps |
| 8/9/2017 8:14 | IP="10.24.2.15" | Direction="Receive" | 115.2 Kbps |
| 8/9/2017 8:15 | IP="192.168.5.2" | Direction="Send" | 515.2 Kbps |
| 8/9/2017 8:15 | IP="192.168.5.2" | Direction="Receive" | 371.1 Kbps |
| 8/9/2017 8:15 | IP="10.24.2.15" | Direction="Send" | 155.0 Kbps |
| 8/9/2017 8:15 | IP="10.24.2.15" | Direction="Receive" | 100.1 Kbps |
Note
Dimension names and dimension values are case-insensitive.
Retention of metrics
Platform and custom metrics
Platform and custom metrics are stored for 93 days with the following exceptions:
Classic guest OS metrics: These performance counters are collected by the Windows diagnostic extension or the Linux diagnostic extension and routed to an Azure Storage account. Retention for these metrics is guaranteed to be at least 14 days, although no expiration date is written to the storage account.
For performance reasons, the portal limits how much data it displays based on volume. So, the actual number of days that the portal retrieves can be longer than 14 days if the volume of data being written isn't large.
Guest OS metrics sent to Azure Monitor Metrics: These performance counters are collected by the Windows diagnostic extension and sent to the Azure Monitor data sink, or the InfluxData Telegraf agent on Linux machines, or the newer Azure Monitor Agent via data-collection rules. Retention for these metrics is 93 days.
Guest OS metrics collected by the Log Analytics agent (retired): The Log Analytics agent was retired in August 2024. Don't deploy it for new metric collection. Use the Azure Monitor Agent instead. For legacy deployments, the Log Analytics agent collected these performance counters and sent them to a Log Analytics workspace. Retention is 31 days and can be extended up to two years.
Application Insights log-based metrics: Behind the scenes, log-based metrics translate into log queries. Their retention is variable and matches the retention of events in underlying logs, which is 31 days to two years. For Application Insights resources, logs are stored for 90 days.
Note
You can send platform metrics for Azure Monitor resources to a Log Analytics workspace for long-term trending.
While platform and custom metrics are stored for 93 days, you can only query (in the Metrics tile) for a maximum of 30 days' worth of data on any single chart. This limitation doesn't apply to log-based metrics. If you see a blank chart or your chart displays only part of metric data, verify that the difference between start and end dates in the time picker doesn't exceed the 30-day interval. After you've selected a 30-day interval, you can pan the chart to view the full retention window.
Note
Moving or renaming an Azure Resource may result in a loss of metric history for that resource.
Prometheus metrics
Prometheus metrics are stored for 18 months, but a PromQL query can only span a maximum of 32 days.
Next steps
- Learn more about the Azure Monitor data platform.
- Learn about log data in Azure Monitor.
- Learn about the monitoring data available for various resources in Azure.