mintel / gcp-quota-exporter

Exports quota limits and usage for Google Compute Platform services
MIT License
7 stars 14 forks source link

Exporter crashes on region quota query #8

Closed bcbrockway closed 4 years ago

bcbrockway commented 4 years ago

Bug Report

Upon failure when querying region quotas the exporter crashes.

Expected Behaviour

It should retry using an exponential back-off.

Actual Behaviour

It crashes completely with invalid memory address or nil pointer dereference:

time="2020-06-26T12:47:11Z" level=info msg="Starting gcp_quota_exporter (version=, branch=, revision=)" source="main.go:164"
time="2020-06-26T12:47:11Z" level=info msg="Build context (go=go1.13.12, user=, date=)" source="main.go:165"
time="2020-06-26T12:47:16Z" level=info msg="Google Project: XXXXXX" source="main.go:210"
time="2020-06-26T12:47:16Z" level=info msg="Listening on :9592" source="main.go:211"
time="2020-06-26T12:51:09Z" level=error msg="Failure when querying region quotas: Get https://www.googleapis.com/compute/v1/projects/XXXXXX/regions?alt=json&prettyPrint=false: net/http: request canceled (Client.Timeout exceeded while awaiting headers)" source="main.go:73"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x88 pc=0xb1a206]

goroutine 124 [running]:
main.(*Exporter).Collect(0xc0002da090, 0xc00036e120)
    /app/main.go:94 +0xc6
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
    /go/pkg/mod/github.com/prometheus/client_golang@v0.9.3/prometheus/registry.go:434 +0x19d
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
    /go/pkg/mod/github.com/prometheus/client_golang@v0.9.3/prometheus/registry.go:526 +0xe12