Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Metrics export using data collection rules
Platform metrics measure the performance of different aspects of your Azure resources. Platform telemetry data collection rules (DCRs) let you collect and export platform metrics from supported Azure resources. This article shows you how to create a DCR for metrics export.
Note
While you can use DCRs and diagnostic settings at the same time, you should disable any diagnostic settings for metrics when using DCRs to avoid duplicate data collection.
Compare to diagnostic settings
Before this feature, you could only export platform metrics by using diagnostic settings. Diagnostic settings are still required for resource types that don't yet support DCRs.
Platform telemetry DCRs provide several benefits over diagnostic settings:
- DCR configuration enables exporting metrics with dimensions.
- DCR configuration enables filtering based on metric name so you can export only the metrics that you need.
- DCRs are more flexible and scalable than diagnostic settings. Use a single DCR with multiple resources, while a separate diagnostic setting is required for each resource.
- End-to-end latency for DCRs is within three minutes, while diagnostic settings export latency is six to ten minutes.
Note
Use metrics export with DCRs for continuous export of metrics data as it's created. To query historical data that's already been collected, use the Data plane Metrics Batch API. See Data plane Metrics Batch API query versus Metrics export for a comparison of the two strategies.
Export destinations
Metrics can be exported to the following destinations.
| Destination type | Details |
|---|---|
| Log Analytics workspaces | Exporting to Log Analytics workspaces can be across regions. The Log Analytics workspace and the DCR must be in the same region but resources that are being monitored can be in any region. Metrics sent to a log analytics workspace are stored in the AzureMetricsV2 table. |
| Azure storage accounts | The storage account, the DCR, and the resources being monitored must all be in the same region. |
| Event Hubs | The Event Hubs, the DCR, and the resources being monitored must all be in the same region. |
Note
Latency for exporting metrics is approximately 3 minutes. Allow up to 15 minutes for metrics to begin to appear in the destination after the initial setup.
Limitations
DCRs for metrics export have the following limitations:
- Only one destination type can be specified per DCR. To send to multiple destinations, create multiple DCRs.
- A maximum of 5 DCRs can be associated with a single Azure resource.
- Metrics export with DCR doesn't support the export of hourly grain metrics.
Supported resources and regions
For the current list of supported resources and supported regions, see Metrics export supported resources and regions.
Create a data collection rule (DCR) for metrics export
This article describes how to create a data collection rule (DCR) for metrics export using the Azure portal, Azure CLI, PowerShell, API, or ARM templates.
Important
To send Platform Telemetry data to Storage Accounts or Event Hubs, the resource, data collection rule, and the destination Storage Account or the Event Hubs must all be in the same region.
Create a data collection rule using the Azure portal
On the Monitor menu in the Azure portal, select Data Collection Rules and then Create.
Select the link on the top of the page to use the new DCR creation experience.
👁 A screenshot showing the create data collection rule page.
On the Create Data Collection Rule page, enter a rule name, select a Subscription, Resource group, and Region for the DCR.
Select PlatformTelemetry for the Type of telemetry and Enable Managed Identity if you want to send metrics to a Storage Account or Event Hubs.
👁 A screenshot showing the basics tab of the create data collection rule page.
On the Resources page, select Add resources to add the resources you want to collect metrics from.
Select Next to move to the Collect and deliver tab.
👁 A screenshot showing the resources tab of the create data collection rule page.
Select Add new datasource.
The resource type of the resource specified in the previous step is automatically selected. Add more resource types if you want to use this rule to collect metrics from multiple resource types in the future. Select the Actions for a resource type if you want to remove some of the metrics collected for it. By default, all available metrics for the resource are collected.
👁 A screenshot showing the collect and deliver tab of the create data collection rule page.
Select Next Destinations to move to the Destinations tab.
Select Add destination and then the Destination type that you want to add. The required fields change based on the destination type you select.
Note
To send metrics to a Storage Account or Event Hubs, the resource generating the metrics, the DCR, and the Storage Account or Event Hub, must all be in the same region. To send metrics to a Log Analytics workspace, the DCR must be in the same region as the Log Analytics workspace. The resource generating the metrics can be in any region.
👁 A screenshot showing the destination tab of collect and deliver page.
Select Save , then select Review + create.
| Variable | Example value | Purpose |
|---|---|---|
| host | management.azure.com | Implicit ARM endpoint |
| subscriptionId | aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e | User input |
| resourceGroupName | myResourceGroup | User input |
| dataCollectionRuleName | myDataCollectionRule | User input |
| associationName | myAssociation | User input |
| location | eastus | User input |
| workspaceName | myWorkspace | User input |
| keyVaultName | myKeyVault | User input |
| storageAccountName | myStorageAccount | User input |
| monitoredResourceName | myKeyVault | User input |
| apiVersion | 2024-03-11 | Reference |
Verify data collection
After creating the DCR, allow up to 30 minutes for the first platform metrics data to appear in the Log Analytics workspace. Once data starts flowing, the latency for a platform metric time series flowing to a Log Analytics workspace, storage account, or Event Hubs is approximately three minutes, depending on the resource type.
Exported data
The following examples show the data exported to each destination.
Log Analytics workspace
Data exported to a Log Analytics workspace is stored in the AzureMetricsV2 table in the Log Analytics workspace in the following format:
| Column | Type | Description |
|---|---|---|
| Average | real | Average value collected during in the time range. |
| _BilledSize | real | The record size in bytes |
| Count | real | Number of samples collected during the time range. |
| Dimension | dynamic | Associated dimension of the metric in JSON format. |
| _IsBillable | string | Specifies whether ingesting the data is billable. When _IsBillable is false ingestion isn't billed to your Azure account |
| Maximum | real | Maximum value collected during in the time range. |
| MetricCategory | string | Category name of the metric. |
| MetricName | string | Display name of the metric. |
| MetricResourceType | string | Resource type of the Azure resource reporting the metric. |
| Minimum | real | Minimum value collected during in the time range. |
| _ResourceId | string | A unique identifier for the resource that the record is associated with |
| SourceSystem | string | The type of agent the event was collected by. For example, OpsManager for Windows agent, either direct connect or Operations Manager, Linux for all Linux agents, or Azure for Azure Diagnostics |
| _SubscriptionId | string | A unique identifier for the subscription that the record is associated with |
| TenantId | string | The Log Analytics workspace ID |
| TimeGenerated | datetime | Timestamp (UTC) when the record was generated. |
| TimeGrain | string | Time grain of the metric. |
| Total | real | Sum of all of the values in the time range. |
| Type | string | The name of the table |
| UnitName | string | Unit of the metric. |
For example:
👁 A screenshot of a log analytics query of the AzureMetricsV2 table.
Storage accounts
The following example shows data exported to a storage account:
{
"Average": "31.5",
"Count": "2",
"Maximum": "52",
"Minimum": "11",
"Total": "63",
"resourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/rg-dcrs/providers/microsoft.keyvault/vaults/dcr-vault",
"time": "2024-08-20T14:13:00.0000000Z",
"unit": "MilliSeconds",
"metricName": "ServiceApiLatency",
"timeGrain": "PT1M",
"dimension": {
"ActivityName": "vaultget",
"ActivityType": "vault",
"StatusCode": "200",
"StatusCodeClass": "2xx"
}
}
Event Hubs
The following example shows a metric exported to Event Hubs.
{
"Average": "1",
"Count": "1",
"Maximum": "1",
"Minimum": "1",
"Total": "1",
"resourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/rg-dcrs/providers/microsoft.keyvault/vaults/dcr-vault",
"time": "2024-08-22T13:43:00.0000000Z",
"unit": "Count",
"metricName": "ServiceApiHit",
"timeGrain": "PT1M",
"dimension": {
"ActivityName": "keycreate",
"ActivityType": "key"
},
"EventProcessedUtcTime": "2024-08-22T13:49:17.1233030Z",
"PartitionId": 0,
"EventEnqueuedUtcTime": "2024-08-22T13:46:04.5570000Z"
}
Verify and troubleshoot data collection
Once you install the DCR, it may take several minutes for the changes to take effect and data to be collected with the updated DCR. If you don't see any data being collected, use the DCR monitoring features, which include metrics and logs to help troubleshooting.
DCR metrics are collected automatically for all DCRs, and you can analyze them using metrics explorer like the platform metrics for other Azure resources. Enable DCR error logs to get detailed error information when data processing isn't successful.
- Check metrics such as
Logs Ingestion Bytes per MinandLogs Rows Received per Minto ensure that the data is reaching Azure Monitor. If not, then check your data source to ensure that it's sending data as expected. - Check
Logs Rows Dropped per Minto see if any rows are being dropped. This may not indicate an error since the rows could be dropped by a transformation. If the rows dropped is the same asLogs Rows Dropped per Minthough, then no data gets ingested in the workspace. Examine theLogs Transformation Errors per Minto see if there are any transformation errors. - Check
Logs Transformation Errors per Minto determine if there are any errors from transformations applied to the incoming data. This could be due to changes in the data structure or the transformation itself. - Check the
DCRLogErrorstable for any ingestion errors that may have been logged. This can provide additional detail in identifying the root cause of the issue.
Next steps
Feedback
Was this page helpful?
