diff --git a/CHANGELOG.md b/CHANGELOG.md index 7238e7b..edf3ed4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 4.0.1 - 2019-05-20 +### Fixed +- Segfault on blank node ingests + ## 4.0.0 - 2019-04-22 ### Changed - Prefixed namespace to provide better uniqueness diff --git a/src/elasticsearch.go b/src/elasticsearch.go index e7cc6ec..1535c9b 100644 --- a/src/elasticsearch.go +++ b/src/elasticsearch.go @@ -28,7 +28,7 @@ type argumentList struct { const ( integrationName = "com.newrelic.elasticsearch" - integrationVersion = "4.0.0" + integrationVersion = "4.0.1" ) var ( diff --git a/src/inventory.go b/src/inventory.go index af4643d..6991752 100644 --- a/src/inventory.go +++ b/src/inventory.go @@ -168,6 +168,11 @@ func parsePluginsAndModules(entity *integration.Entity, stats *LocalNode) { } func parseNodeIngests(entity *integration.Entity, stats *LocalNode) []string { + if stats.Ingest == nil || stats.Ingest.Processors == nil { + log.Error("No ingest stats defined for node. Skipping processor list collection", stats.Name) + return []string{} + } + processorList := stats.Ingest.Processors typeList := []string{} diff --git a/src/inventory_test.go b/src/inventory_test.go index d385d1e..18bfaf7 100644 --- a/src/inventory_test.go +++ b/src/inventory_test.go @@ -260,3 +260,15 @@ func writeGoldenFile(t *testing.T, goldenPath string, data []byte) { assert.NoError(t, err) } } + +func Test_parseNodeIngests_Nil(t *testing.T) { + _, e := getTestingEntity(t) + nodeName := "test" + testNode := LocalNode{ + Name: &nodeName, + Ingest: nil, + } + + types := parseNodeIngests(e, &testNode) + assert.Equal(t, []string{}, types) +}