question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BadRequest on certain supported dimensions for Microsoft.DocumentDb (CosmosDb)

See original GitHub issue

Report

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 OperationType and StatusCode are 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 '*'&timespan=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 '*'&timespan=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:closed
  • Created a year ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tomkerkhovecommented, Aug 8, 2022

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.

1reaction
tomkerkhovecommented, Jul 23, 2022

Is it possible to define multiple dimensions in the same scrape

Not today but we have an open feature request for this, feel free to subscribe to that one and give it a thumbs up

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot Azure Cosmos DB bad request exceptions
Learn how to diagnose and fix bad request exceptions such as input content or partition key is invalid, partition key doesn't match in...
Read more >
HTTP Status Codes for Azure Cosmos DB
HTTP status and sub-status codes when using Azure Cosmos DB with ... 400 Bad request, The JSON, SQL, or JavaScript in the request...
Read more >
Querying Azure Cosmos DB resources using the REST API
Learn how to query Azure Cosmos DB resources using REST API. Request and response headers, body, status codes and examples.
Read more >
Azure Stream Analytics output to Azure Cosmos DB
Stream Analytics integration with Azure Cosmos DB allows you to insert or update records in your container based on a given Document ID...
Read more >
Troubleshoot common errors in Azure Cosmos DB's API for ...
Code Error Description 13 Unauthorized The request lacks the permissions to complete. 67 CannotCreateIndex The request to create an index can't be completed. 115 CommandNotSupported The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found