From 53a13ba5c3c5ec416263818300943c4b13234f1c Mon Sep 17 00:00:00 2001 From: kgeckhart Date: Wed, 3 Apr 2024 06:58:03 -0400 Subject: [PATCH] azure_exporter: Fix bug which prevents subscription scope from working with only a single region (#6719) --- CHANGELOG.md | 2 ++ internal/static/integrations/azure_exporter/azure_exporter.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a99df03268d8..268c15b4bca0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,8 @@ Main (unreleased) - Fix an issue where JSON string array elements were not parsed correctly in `loki.source.cloudflare`. (@thampiotr) +- Fix an issue where the azure exporter was not correctly gathering subscription scoped metrics when only one region was configured (@kgeckhart) + - Update gcp_exporter to a newer version with a patch for incorrect delta histograms (@kgeckhart) - Fix an issue where the default values of some component's arguments change diff --git a/internal/static/integrations/azure_exporter/azure_exporter.go b/internal/static/integrations/azure_exporter/azure_exporter.go index dd8e6b267790..1f18e240e744 100644 --- a/internal/static/integrations/azure_exporter/azure_exporter.go +++ b/internal/static/integrations/azure_exporter/azure_exporter.go @@ -81,7 +81,7 @@ func (e Exporter) MetricsHandler() (http.Handler, error) { // "RunOnSubscriptionScope" uses a different API, https://github.com/Azure/azure-rest-api-specs/blob/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/metrics_API.json#L40, // which can get metric data for all resources in a single API call reducing overhead/likelihood of being rate limited. // Limiting to specific resources requires 1 API call per resource to get metrics which can easily lead to rate limiting - if len(settings.Regions) > 1 { + if len(settings.Regions) > 0 { prober.RunOnSubscriptionScope() } else { err = prober.ServiceDiscovery.FindResourceGraph(ctx, settings.Subscriptions, settings.ResourceType, settings.Filter)