Skip to content

Commit

Permalink
Fix unused libbeat.config.module metrics
Browse files Browse the repository at this point in the history
These metrics existed in the code but were unused and hence always 0.

"libbeat":{"config":{"module":{"running":0,"starts":0,"stops":0}

I updated the module reload code to increment and set the metrics when changes are applied.
  • Loading branch information
andrewkroh committed Jun 12, 2020
1 parent 138a23a commit 629b379
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- The `monitoring.elasticsearch.api_key` value is correctly base64-encoded before being sent to the monitoring Elasticsearch cluster. {issue}18939[18939] {pull}18945[18945]
- Fix kafka topic setting not allowing upper case characters. {pull}18854[18854] {issue}18640[18640]
- Fix redis key setting not allowing upper case characters. {pull}18854[18854] {issue}18640[18640]
- Fix config reload metrics (`libbeat.config.module.start/stops/running`). {pull}19168[19168]

*Auditbeat*

Expand Down
4 changes: 4 additions & 0 deletions libbeat/cfgfile/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func (r *RunnerList) Reload(configs []*reload.ConfigWithMeta) error {
r.logger.Debugf("Stopping runner: %s", runner)
delete(r.runners, hash)
go runner.Stop()
moduleStops.Add(1)
}

// Start new runners
Expand All @@ -101,8 +102,11 @@ func (r *RunnerList) Reload(configs []*reload.ConfigWithMeta) error {
r.logger.Debugf("Starting runner: %s", runner)
r.runners[hash] = runner
runner.Start()
moduleStarts.Add(1)
}

moduleRunning.Set(int64(len(r.runners)))

return errs.Err()
}

Expand Down

0 comments on commit 629b379

Please sign in to comment.