BadRequest on certain supported dimensions for Microsoft.DocumentDb (CosmosDb)
See original GitHub issueReport
Bad Request on certain supported dimensions for Microsoft.DocumentDb (CosmosDb)
I am having some problems using Promitor for monitoring our CosmosDb account. Whenever we try to use the metric TotalRequests with the dimension DatabaseName or CollectionName we end up getting a BadRequest error (this is surely not the only metric with the problem).
If I misconfigure the metric to something non-existant, it actually lists the supported types (which I already checked on the azure metrics documentation before)
promitor-agent-scraper | [14:50:07 FTL] BadRequest: Metric: TotalRequests does not support requested dimension combination: collection, supported ones are: DatabaseName,CollectionName,Region,StatusCode,Operation
Type,Status, TraceId: {4732ea53-769d-46dc-b01c-1bc97dfec019}
- The dimensions
OperationTypeandStatusCodeare working perfectly. - The REST API calls for DatabaseName and CollectionName using postman work correctly:
https://management.azure.com/subscriptions/{{azure_subscription}}/resourceGroups/{{azure_resource_group}}/providers/Microsoft.DocumentDB/databaseAccounts/{{azure_database_account}}/providers/microsoft.insights/metrics?api-version=2018-01-01&metricnames=TotalRequests&aggregation=Count&$filter=DatabaseName eq '*'
Side question:
Is it possible to define multiple dimensions in the same scrape? For example DatabaseName and CollectionName at the same time (it works via the rest api)? I could not find any relevant information about the dimensions in the documentation.
Expected Behavior
promitor-agent-scraper | [15:16:36 INF] Found value XXX for metric azure_cosmosdb_requests_count_per_databasename with dimension mydatabase as part of DatabaseName dimension with aggregation interval 00:01:00
promitor-agent-scraper | [15:16:36 INF] Found value XXX for metric azure_cosmosdb_requests_count_per_collectionname with dimension mycollection as part of CollectionName dimension with aggregation interval 00:01:00
Actual Behavior
promitor-agent-scraper | [15:16:36 FTL] BadRequest: Failed to serialize response for request: https://eastus.mdmrp.prod.windows.azure.net/subscriptions/xxxx/resourceGroups/xxxx/providers/Microsoft.DocumentDB/databaseAccounts/xxxx/providers/microsoft.insights/metrics?$filter=DatabaseName eq '*'×pan=2022-07-16T15%3A16%3A33.7185239Z%2F2022-07-21T15%3A16%3A33.7185239Z&interval=PT1M&metricnames=TotalRequests&aggregation=Count&top=10000&api-version=2018-01-01, Duration: 00:00:00.9531691, TraceId: {0dbc4b22-d436-431f-8d7f-c1419ab12bfd}
promitor-agent-scraper | [15:16:37 FTL] BadRequest: Failed to serialize response for request: https://eastus.mdmrp.prod.windows.azure.net/subscriptions/xxxx/resourceGroups/xxxx/providers/Microsoft.DocumentDB/databaseAccounts/xxxx/providers/microsoft.insights/metrics?$filter=CollectionName eq '*'×pan=2022-07-16T15%3A16%3A33.6484503Z%2F2022-07-21T15%3A16%3A33.6484503Z&interval=PT1M&metricnames=TotalRequests&aggregation=Count&top=10000&api-version=2018-01-01, Duration: 00:00:01.7187700, TraceId: {28a1469e-3b01-4ff4-a009-b1c3e4a01af3}
Steps to Reproduce the Problem
Add a metrics declaration for CosmosDb that uses either DatabaseName or CollectionName
- name: azure_cosmosdb_requests_count_per_collectionname
description: Azure CosmosDb total requests per collectionname
resourceType: CosmosDb
azureMetricConfiguration:
metricName: TotalRequests
aggregation:
type: Count
dimension:
name: CollectionName
resources:
- dbName: xxxx
resourceGroupName: xxxx
Component
Scraper
Version
2.5.0, 2.6.0 (2.7.0 errors complaining about Resource Discovery not being defined)
Configuration
version: v1
azureMetadata:
tenantId: xxxx
subscriptionId: xxxx
resourceGroupName: xxxx
metricDefaults:
aggregation:
interval: 00:01:00
scraping:
schedule: "*/1 * * * *"
metrics:
- name: azure_cosmosdb_requests_count_per_collectionname
description: Azure CosmosDb total requests per collectionname
resourceType: CosmosDb
azureMetricConfiguration:
metricName: TotalRequests
aggregation:
type: Count
dimension:
name: CollectionName
resources:
- dbName: xxxx
resourceGroupName: xxxx
Logs
See “actual behaviour”
Platform
Microsoft Azure
Contact Details
No response
Issue Analytics
- State:
- Created a year ago
- Comments:9 (6 by maintainers)

Top Related StackOverflow Question
It’s OK to keep this one, no worries and hope you’ve had a good holiday!
I’ll do my best to get this sorted asap but there’s a few bugs that need patching. Let me know how I can help.
Not today but we have an open feature request for this, feel free to subscribe to that one and give it a thumbs up