githubexporter / github-exporter

:octocat: Prometheus exporter for github metrics

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

change stdout print to log

gsanchezgavier opened this issue · comments

Hi, I found that there is a print to the stdout here this cause some verbosity in the default behavior of the exporter.
Would be ok to change this to a log.Debug so it can be controlled with the logs verbose mode?

@gsanchezgavier Can you give the latest development release a test please? This shouldn't be an issue anymore.

@Rucknar I did a quick test and got some panic error.

Would be possible to have this PR merged so we can have an short incremental improvement of the code? Thanks!

here is the panic i mentioned above:

{"APIToken":"","APITokenEnv":"","APITokenFile":"","APIURL":"https://api.github.com","Config":{},"OptionalMetrics":[""],"Organisations":[""],"Repositories":[""],"Users":[""],"level":"info","msg":"Starting Exporter","time":"2020-10-09T09:31:56+02:00"}
{"level":"info","msg":"Initialising capture of metrics","time":"2020-10-09T09:32:34+02:00"}
{"level":"error","msg":"Error gathering API Rate limits: GET https://api.github.com/rate_limit: 401 Bad credentials []","time":"2020-10-09T09:32:34+02:00"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x14dc872]

goroutine 42 [running]:
github.com/infinityworks/github-exporter/exporter.(*Exporter).gatherRates(0xc000190360)
	/Users/gsanchez/go/src/github.com/infinityworks/github-exporter/exporter/gather.go:65 +0xd2
github.com/infinityworks/github-exporter/exporter.(*Exporter).Collect(0xc000190360, 0xc000170480)
	/Users/gsanchez/go/src/github.com/infinityworks/github-exporter/exporter/gather.go:33 +0xc0
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
	/Users/gsanchez/go/pkg/mod/github.com/prometheus/client_golang@v1.7.1/prometheus/registry.go:444 +0x19d
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
	/Users/gsanchez/go/pkg/mod/github.com/prometheus/client_golang@v1.7.1/prometheus/registry.go:455 +0x57d