webdevops / azure-metrics-exporter

Azure Monitor metrics exporter for Prometheus with dimension support, template engine and ServiceDiscovery
MIT License
118 stars 24 forks source link

allow resourceType and filter to both be specified #63

Closed sding3 closed 8 months ago

sding3 commented 9 months ago
allow resourceType and filter to both be specified

One quirk about the ARM resource list API is that the $filter
specification requires the resourceType be used in very specific
ways as hilighted in this issue:

  https://github.com/Azure/azure-rest-api-specs/issues/21324

Due to that quick, azure-metrics-exporter disallowed scrape
configs specifying both resourceType and filter.

It would be useful to allow specifying both resourceType and
filter for cases where the user wish to target only a subset
of resources of a given type. The following example was a case
where the user wanted to do that, but ended up working around
the issue by using the substringof $filter keyword.

  https://github.com/webdevops/azure-metrics-exporter/issues/51

The substringof $filter keyword only works for targetting
resource name and resource group, and it does not work for
targetting resource tag names or values.

This update makes speciying both resourceType and filter to become
allowed by filtering for the specified resourceType locally.
sonarcloud[bot] commented 9 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

mblaschke commented 8 months ago

why not use ResourceGraph as it offers much better flexibility?

sding3 commented 8 months ago

why not use ResourceGraph as it offers much better flexibility?

great - totally missed that initially.