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

`panic: send on closed channel`

Open DazWilkin opened this issue 3 years ago • 0 comments

Code panicking:

panic: send on closed channel

goroutine 4654 [running]:
github.com/DazWilkin/gcp-exporter/collector.(*FunctionsCollector).Collect.func1(...)
	/gcp-exporter/collector/functions.go:138 +0x807
created by github.com/DazWilkin/gcp-exporter/collector.(*FunctionsCollector).Collect
	/gcp-exporter/collector/functions.go:80 +0x12a

The error does not arise immediately and it's always functions.go:138 but why is the (Prometheus-owned) channel being closed? Is the functions.go code taking too long (now) to complete and timing out?

The error may have been introduced when I added the Cloud Functions code:

ch <- prometheus.MustNewConstMetric(
	c.Functions,
	prometheus.GaugeValue,
	float64(functions),
	[]string{
		p.ProjectId,
	}...,
)

Sometimes it arrives quickly and others after several hours.

Either something that I've introduced into gcp-exporter (most likely) Or a change in the Google API behavior

DazWilkin avatar Jun 07 '21 18:06 DazWilkin