Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing label when ListObjectsV2 call returns an error #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

qaoru
Copy link

@qaoru qaoru commented Jun 2, 2022

This fixes a panic occuring when the ListObjectsV2 call returns an error (bucket does not exist, user not authorized, ...).

INFO[0000] Listening on :9340                            source="s3_exporter.go:301"
ERRO[0014] NoSuchBucket: The specified bucket does not exist
        status code: 404, request id: 16F4DB470BC51C7C, host id:   source="s3_exporter.go:112"
panic: inconsistent label cardinality: expected 3 label values but got 2 in []string{"foobar", ""}

goroutine 39 [running]:
github.com/prometheus/client_golang/prometheus.MustNewConstMetric(...)
        /home/pheng/Git/github/s3_exporter/vendor/github.com/prometheus/client_golang/prometheus/value.go:107
main.(*Exporter).Collect(0xc000310440, 0xc000370f60?)
        /home/pheng/Git/github/s3_exporter/s3_exporter.go:113 +0x3eb
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
        /home/pheng/Git/github/s3_exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:444 +0xfb
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
        /home/pheng/Git/github/s3_exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:455 +0x4c5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant