Skip to content

Commit

Permalink
Merge pull request #49 from newrelic/bug/node-ingest-segfault
Browse files Browse the repository at this point in the history
Fix segfault for non-existant node ingests
  • Loading branch information
camdencheek authored May 20, 2019
2 parents 3e29a18 + 86d373b commit 3fdc3bf
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type argumentList struct {

const (
integrationName = "com.newrelic.elasticsearch"
integrationVersion = "4.0.0"
integrationVersion = "4.0.1"
)

var (
Expand Down
5 changes: 5 additions & 0 deletions src/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}

Expand Down
12 changes: 12 additions & 0 deletions src/inventory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 3fdc3bf

Please sign in to comment.