From ed0c100d40841ce75f44d6981558a211239d4256 Mon Sep 17 00:00:00 2001 From: Jie WU Date: Tue, 16 Jun 2026 10:04:36 -0400 Subject: [PATCH] Fix error handling in getMetricDescriptors getMetricDescriptors was returning a nil error even when it failed to fetch metric descriptors due to an API error. This caused the cache manager to overwrite the descriptor cache with partial or empty data, silencing metric exports. This change ensures that the actual error is returned so that the cache manager can retain the previous cache. --- prometheus-to-sd/translator/stackdriver.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prometheus-to-sd/translator/stackdriver.go b/prometheus-to-sd/translator/stackdriver.go index 3b5cf5787..fe97d2ca0 100644 --- a/prometheus-to-sd/translator/stackdriver.go +++ b/prometheus-to-sd/translator/stackdriver.go @@ -97,7 +97,7 @@ func getMetricDescriptors(ctx context.Context, client *monitoring.MetricClient, } if err != nil { glog.Warningf("Error while fetching metric descriptors for %v: %v", config.SourceConfig.Component, err) - return metrics, nil + return nil, err } if _, metricName, err := parseMetricType(config, metricDescriptor.Type); err == nil { metrics[metricName] = metricDescriptor