Skip to content

Cherry-pick #8023 to 6.x: Heartbeat Automatic Reload#8315

Merged
andrewvc merged 1 commit intoelastic:6.xfrom
andrewvc:backport_8023_6.x
Sep 17, 2018
Merged

Cherry-pick #8023 to 6.x: Heartbeat Automatic Reload#8315
andrewvc merged 1 commit intoelastic:6.xfrom
andrewvc:backport_8023_6.x

Conversation

@andrewvc
Copy link
Copy Markdown
Contributor

Cherry-pick of PR #8023 to 6.x branch. Original message:

This WIP patch brings heartbeat automatic reloading in-line with other Beats, using the standard reload feature. It is not yet ready for any sort of review. I'm mostly posting this to get CI running on it. This patch:

  1. Adds a monitors.configuration option, that enables reloading individual monitor YAML blocks from a directory (monitors.d/*.yml by default).
  2. Removes the poll_file functionality
  3. Significantly refactors the monitor manager to accomplish this
  4. Cleans up the naming of some core data-structures and flow of management operations.

This is currently a WIP, it definitely needs a good number more tests.

This will be a significant breaking change due to the removal of poll file functionality, but since heartbeat is still in beta, we can and should do this due to the non-standard nature of the poll_file.

Add automatic reloading for heartbeat config files.

This deprecates the `watch.poll_file` options.

This patch also fixes a potential source of races in code using `cfgfile/Runner` by making that interface implement `Stringer`, the reason being that by default `cfgfile/Runner` can recursively print the backing structure, which can trigger a race.

(cherry picked from commit 037a4f2)
return fmt.Sprintf("Monitor not loaded, plugin is disabled")
}

type MonitorPluginInfo struct {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported type MonitorPluginInfo should have comment or be unexported

"github.com/elastic/beats/libbeat/common"
)

type PluginDisabledError struct{}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported type PluginDisabledError should have comment or be unexported

}
}

func (m *Monitor) Stop() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method Monitor.Stop should have comment or be unexported

return nil
}

func (m *Monitor) Start() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method Monitor.Start should have comment or be unexported

@andrewvc
Copy link
Copy Markdown
Contributor Author

Hmmm, I don't know why these hound errors weren't in the original PR.

I'd prefer to merge this as is to keep the diff as close to #8023 as possible, and fix these issues in a subsequent PR.

@andrewvc
Copy link
Copy Markdown
Contributor Author

Created a PR with those changes in #8316

@andrewvc andrewvc merged commit 2e0ec42 into elastic:6.x Sep 17, 2018
@urso urso mentioned this pull request Sep 17, 2018
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants