Skip to content

Commit 541c559

Browse files
committed
skip target when an error occurs
This fixes: level=error msg="Error retrieving Link headers, Error: Get https://api.github.com/repos/XXXXXXX?&per_page=100: net/http: request canceled (Client.Timeout exceeded while awaiting headers)" panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x755810] goroutine 359851 [running]: github.com/infinityworks/github-exporter/exporter.paginateTargets(0xc420138000, 0xd, 0x10, 0xc42001e00d, 0x28, 0x0, 0x3, 0x0) /go/src/github.com/infinityworks/github-exporter/exporter/http.go:65 +0x170 github.com/infinityworks/github-exporter/exporter.asyncHTTPGets(0xc420138000, 0xd, 0x10, 0xc42001e00d, 0x28, 0xc4207162d8, 0xc4201aefc0, 0xc4201aef9e, 0x0, 0xc4201aef98) /go/src/github.com/infinityworks/github-exporter/exporter/http.go:17 +0x74 github.com/infinityworks/github-exporter/exporter.(*Exporter).gatherData(0xc420084fa0, 0x1, 0x1, 0xc4201aee78, 0x6a780f, 0xc420060120, 0x82d7d4) /go/src/github.com/infinityworks/github-exporter/exporter/gather.go:16 +0x91 github.com/infinityworks/github-exporter/exporter.(*Exporter).Collect(0xc420084fa0, 0xc4205d6060) /go/src/github.com/infinityworks/github-exporter/exporter/prometheus.go:22 +0x40 github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1() /go/src/github.com/prometheus/client_golang/prometheus/registry.go:434 +0x1b3 created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather /go/src/github.com/prometheus/client_golang/prometheus/registry.go:445 +0x5ac
1 parent ed4fd1e commit 541c559

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

exporter/http.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ func paginateTargets(targets []string, token string) []string {
6060
resp, err := getHTTPResponse(url, token)
6161
if err != nil {
6262
log.Errorf("Error retrieving Link headers, Error: %s", err)
63+
continue
6364
}
6465

6566
if resp.Header["Link"] != nil {

0 commit comments

Comments
 (0)