gcp-exporter icon indicating copy to clipboard operation
gcp-exporter copied to clipboard

Project filtering is (recursively) adding `lifecycleState:ACTIVE`

Open DazWilkin opened this issue 3 years ago • 0 comments

After running GCP Exporter for a while:

gcp-exporter     | 2021/04/24 18:34:18 Projects filter: 'lifecycleState:ACTIVE lifecycleState:ACTIVE ...'

There should only ever be a single occurrence.

Grrr:

type ProjectsCollector struct {
	filter   string
	...
}

// Collect implements Prometheus' Collector interface and is used to collect metrics
func (c *ProjectsCollector) Collect(ch chan<- prometheus.Metric) {
	...
	// Combine any user-specified filter with "lifecycleState:ACTIVE" to only process active projects
	if c.filter != "" {
		c.filter += " "
	}
	c.filter = c.filter + "lifecycleState:ACTIVE"
	...
}

DazWilkin avatar Apr 24 '21 20:04 DazWilkin