tomkerkhove / promitor

Bringing Azure Monitor metrics where you need them.
https://promitor.io
MIT License
250 stars 92 forks source link

ServiceBus metric error when Dimension is not EntityName #2557

Open maletsiri opened 2 weeks ago

maletsiri commented 2 weeks ago

Report

when a metric dimension does not include EntityName, the scrapping results in Bad Request

Here is a list of metrics for a Service Bus: #https://learn.microsoft.com/en-us/azure/azure-monitor/reference/supported-metrics/microsoft-servicebus-namespaces-metrics

The following metric names do not work as they don't have EntityName as one of the dimension they support, only EntityName metric work.

Expected Behavior

Actual Behavior

when the configuration does not explicitly details the dimension, the following is observed in the logs

azureMetricConfiguration: metricName: ActiveConnections aggregation: type: Total interval: 00:15:00

[07:41:12 FTL] BadRequest: Metric: NamespaceCpuUsage does not support requested dimension combination: entityname, supported ones are: , TraceId: {b97c783f-68a7-494c-93be-df8edc459425} [07:41:12 FTL] BadRequest: Metric: ActiveConnections does not support requested dimension combination: entityname, supported ones are: , TraceId: {15937d8b-9d95-421c-ae92-82ece5cfa310} [07:41:12 FTL] BadRequest: Metric: NamespaceMemoryUsage does not support requested dimension combination: entityname, supported ones are: , TraceId: {5f2d157d-4fb8-430d-925f-d067a39a360f}

when dimension is included in the spec Note, if you don't specify dimension, it will auto use EntityName as dimension

azureMetricConfiguration: metricName: ActiveConnections limit: 5 dimension: name: "none" aggregation: type: Total interval: 00:15:00

in the case of NamespaceCpuUsage

azureMetricConfiguration: metricName: NamespaceCpuUsage limit: 5 dimension: name: Replica aggregation: type: Maximum interval: 00:15:00

the following error is in the logs

[07:34:27 FTL] BadRequest: Metric: NamespaceMemoryUsage can not support requested dimensions: replica, because it include hidden dimensions: Replica [07:34:27 FTL] BadRequest: Metric: NamespaceCpuUsage can not support requested dimensions: replica, because it include hidden dimensions: Replica BadRequest: Metric: ActiveConnections does not support requested dimension combination: entityname, supported ones are: , TraceId: {ec07be04-46cc-4b44-b16d-35580a53bf8d}

Steps to Reproduce the Problem

  1. select any metric for servicebus that does not have EntityName as the dimension
  2. https://learn.microsoft.com/en-us/azure/azure-monitor/reference/supported-metrics/microsoft-servicebus-namespaces-metrics
  3. Dimensions of Replica and none don't work. ...

Component

Scraper

Version

v2.11

Configuration

Configuration:

azureMetricConfiguration: metricName: NamespaceCpuUsage limit: 5 dimension: name: Replica aggregation: type: Maximum interval: 00:15:00

Logs

[07:34:27 FTL] BadRequest: Metric: NamespaceMemoryUsage can not support requested dimensions: replica, because it include hidden dimensions: Replica [07:34:27 FTL] BadRequest: Metric: NamespaceCpuUsage can not support requested dimensions: replica, because it include hidden dimensions: Replica BadRequest: Metric: ActiveConnections does not support requested dimension combination: entityname, supported ones are: , TraceId: {ec07be04-46cc-4b44-b16d-35580a53bf8d}

Platform

Microsoft Azure

Contact Details

j.marome@gmail.com

github-actions[bot] commented 2 weeks ago

Thank you for opening an issue! We rely on the community to maintain Promitor. (Learn more)

Is this something you want to contribute?

hkfgo commented 15 hours ago

We had ran into the same issue. I believe it's because dedicated scraper class for ServiceBus always include an EntityName filter in its requests: https://github.com/tomkerkhove/promitor/blob/1bafcd9dbb23f971692b49d47e01138b9bf2f55d/src/Promitor.Core.Scraping/ResourceTypes/AzureMessagingScraper.cs#L55

But not all metrics support the EntityNamedimension: https://learn.microsoft.com/en-us/azure/azure-monitor/reference/supported-metrics/microsoft-servicebus-namespaces-metrics

I saw the scraper was written years ago, and I suspect some the underlying assumptions about MessageBus can't quite hold now. @tomkerkhove unless there's a way to override that EntityName dimension filter in configuration(I don't believe so), this would probably require a PR to fix. I'll see if I or anyone on my team has bandwidth to take a look