Skip to content

Commit

Permalink
Fixing nil pointer on prometheus collector when http response is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
vjsamuel committed Apr 26, 2017
1 parent 7a8bc70 commit 55a9bc6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ https://github.com/elastic/beats/compare/v5.1.1...master[Check the HEAD diff]
- Add kubelet module {pull}3916[3916]
- Add dropwizard module {pull}4022[4022]
- Adding query APIs for metricsets and modules from metricbeat registry {pull}4102[4102]
- Fixing nil pointer on prometheus collector when http response is nil {pull}4119[4119]

*Packetbeat*
- Add `fields` and `fields_under_root` to packetbeat protocols configurations. {pull}3518[3518]
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/prometheus/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
func (m *MetricSet) Fetch() ([]common.MapStr, error) {

resp, err := m.http.FetchResponse()
defer resp.Body.Close()
if err != nil {
return nil, err
}
defer resp.Body.Close()
families, err := prometheus.GetMetricFamiliesFromResponse(resp)

if err != nil {
Expand Down

0 comments on commit 55a9bc6

Please sign in to comment.