Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support To Provide Dimensions #93

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

neerajmangal
Copy link

  • Added support to provide dimensions to fetch multi-dimensional metrics.
  • Provided Dimensions will be added as labels
  • --list.definitions will provide supported dimension in each metric
  • Fix - --list.definitions option was not working with resourceTag filter.

@@ -106,6 +114,9 @@ When the metric namespace is specified, it will be added as a prefix of the metr
It can be used to target [custom metrics](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/metrics-custom-overview), such as [guest OS performance counters](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/collect-custom-metrics-guestos-vm-classic).
If not specified, the default metric namespace of the resource will apply.

The `dimensions` property is optional for all filtering types. If `dimensions` property is provided, it will add the provided dimensions as label in the metrics.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused. The example is a filter, however this then talks about adding labels to the output. Those sound like orthogonal things to me.

If there's labels we need for correctness, we should already be applying them automatically.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the confusion. I should be more clear about this.
I mean to say Metrics dimensions configuration can be provided in all filtering types (ResourceTags, ResourceGroups, and Targets).
Adding a label with each dimension will provide the ability to consume/filter these metrics based on labels for visualization and alerting.

This is useful in the case of multi-dimensional metrics. For example, CosmosDB's TotalRequests metric provides Total Request Count without any dimension.

totalrequests_count_average{resource_group="cna_nonprod_db",resource_name="cna-nonprod-db"} 0
totalrequests_count_average{resource_group="cosmosdb_nonprod",resource_name="adobeio-runtime-mw-nonprod"} 1.8411764705882352

if the dimension StatusCode and CollectionName provided then the metric response will contain for each StatusCode for CollectionName and StatusCode and CollectionName will be added as label in the metric.

totalrequests_count_average{collectionname="Activations",resource_group="cosmosdb_nonprod",resource_name="runtime-mw-nonprod",statuscode="201"} 7.105298457411133
totalrequests_count_average{collectionname="aio-state-container",resource_group="cna_nonprod_db",resource_name="cna-nonprod-db",statuscode="200"} 0  

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's two separate features that'd need to be evaluated independently then. Filtering is for performance, the presence of labels is for correctness and should never depend on filtering being configured.

Copy link

@hacst hacst Feb 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brian-brazil I think this approach is required by the underlying API. See https://docs.microsoft.com/en-us/azure/azure-monitor/platform/rest-api-walkthrough#retrieve-metric-values-multi-dimensional-api

If no dimension filters are specified, the rolled up aggregated metric is returned.

My reading is that this means you cannot retrieve dimensions without a filter. From a users point of view I also think this behavior is desirable as otherwise you are likely to retrieve too much or future changes to the dimensionality might break you.

It would be great to see this PR go ahead as it implements very useful functionality. E.g. I'm currently trying to get the message count in azure service bus metrics. azure-metrics-exporter seems perfect for that but without dimensions I only get message count aggregates at the azure service bus namespace level instead of per queue/topic information with is in a EntityName dimension.

@gregoryfischer
Copy link

#85 (comment)

@vipinvkmenon
Copy link

vipinvkmenon commented May 19, 2021

Looking forward to seeing this PR merged. The PR is rather important as it seems that unless dimensions are explicitly mentioned, we would just get up a rolled-up aggregate.

@brian-brazil
Copy link
Member

Is there a way to get all dimensions automatically without requiring user configuration?

@andreibogdan
Copy link

This PR will be merged? I am waiting for dimensions feature to be implemented.

@nodunnock
Copy link

I was looking for this. I tried this branch and it worked almost as expected except I only got one dimension value in my output. Despite a filter like so:
dimensions: "EntityName eq '*'"

@eugenecherepanov
Copy link

Hi all, will we have any chance for merging this PR?

@kebagb
Copy link

kebagb commented Nov 8, 2022

Hello,
Has this been implemented?

I have a need to use dimensions to identify any BackupHealthEvents in RecoveryServiceVaults where the HealthStatus is not Healthy.

We've done something similar on our old monitoring platform using a python script to call the Azure API with the relevant URL and parameters, but now we have a need to do the same thing via Prometheus and would like to do this using AzureMetricsExporter.

Based on the comment above, I assume this would be done using config like :
dimensions: "HealthStatus ne 'Healthy'"

I'm not entirely sure where this would fit into the rest of the configuration for that particular metric/resource.

Thanks

Kevin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants