Skip to content

Commit ac333d1

Browse files
add a nil reference check during retries (#98)
* add a nil reference check during retries * update CHANGELOG
1 parent 27dcec2 commit ac333d1

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ log is based on the [Keep a CHANGELOG](http://keepachangelog.com/) project.
66

77
## Unreleased
88

9+
## Fixed
10+
11+
- nil pointer dereference during a scrape [#97](https://github.com/Comcast/fishymetrics/issues/97)
12+
13+
## [0.12.0]
14+
915
## Added
1016

1117
- Add ability to reference different vault paths for credential retrieval [#25](https://github.com/Comcast/fishymetrics/issues/25)

common/util.go

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ func Fetch(uri, host, profile string, client *retryablehttp.Client) func() ([]by
5656
for retryCount < 3 && resp.StatusCode == http.StatusNotFound {
5757
time.Sleep(client.RetryWaitMin)
5858
resp, err = DoRequest(client, req)
59+
if err != nil {
60+
return nil, err
61+
}
5962
retryCount = retryCount + 1
6063
}
6164
if err != nil {

exporter/moonshot/exporter.go

+3
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ func fetch(uri, device, metricType, host, profile string, client *retryablehttp.
212212
for retryCount < 3 && resp.StatusCode == http.StatusNotFound {
213213
time.Sleep(client.RetryWaitMin)
214214
resp, err = common.DoRequest(client, req)
215+
if err != nil {
216+
return nil, device, metricType, err
217+
}
215218
retryCount = retryCount + 1
216219
}
217220
if err != nil {

0 commit comments

Comments
 (0)