Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heartbeat Automatic Reload #8023

Merged
merged 5 commits into from
Sep 14, 2018
Merged

Heartbeat Automatic Reload #8023

merged 5 commits into from
Sep 14, 2018

Conversation

andrewvc
Copy link
Contributor

@andrewvc andrewvc commented Aug 20, 2018

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.

@andrewvc andrewvc added in progress Pull request is currently in progress. Heartbeat labels Aug 20, 2018
client beat.Client
}

type InvalidMonitorProcessorsError struct{ root error }

Choose a reason for hiding this comment

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

exported type InvalidMonitorProcessorsError should have comment or be unexported

e, found := r.modules[name]
if !found {
return nil
}
return e.Create
}

func (r *Registrar) AddActive(name string, builder ActiveBuilder) error {
func (r *Registry) AddActive(name string, builder ActiveBuilder) error {

Choose a reason for hiding this comment

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

exported method Registry.AddActive should have comment or be unexported

e, found := r.modules[name]
return e.info, found
}

func (r *Registrar) GetFactory(name string) Factory {
func (r *Registry) GetFactory(name string) JobFactory {

Choose a reason for hiding this comment

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

exported method Registry.GetFactory should have comment or be unexported


return nil
}

func (r *Registrar) Query(name string) (Info, bool) {
func (r *Registry) Query(name string) (BasicInfo, bool) {

Choose a reason for hiding this comment

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

exported method Registry.Query should have comment or be unexported

panic(err)
}
}

func (r *Registrar) Register(name string, t Type, builder ActiveBuilder) error {
func (r *Registry) Register(name string, t Type, builder ActiveBuilder) error {

Choose a reason for hiding this comment

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

exported method Registry.Register should have comment or be unexported

pipeline beat.Pipeline
}

func NewMonitor(

Choose a reason for hiding this comment

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

exported function NewMonitor should have comment or be unexported

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

type Monitor struct {

Choose a reason for hiding this comment

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

exported type Monitor should have comment or be unexported


type JobRunner func() (beat.Event, []JobRunner, error)

type JobFactory func(*common.Config) ([]Job, error)

Choose a reason for hiding this comment

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

exported type JobFactory should have comment or be unexported

Run() (beat.Event, []JobRunner, error)
}

type JobRunner func() (beat.Event, []JobRunner, error)

Choose a reason for hiding this comment

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

exported type JobRunner should have comment or be unexported

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

type Job interface {

Choose a reason for hiding this comment

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

exported type Job should have comment or be unexported

return &ReloaderFactory{sched}
}

func (f *ReloaderFactory) Create(p beat.Pipeline, c *common.Config, meta *common.MapStrPointer) (cfgfile.Runner, error) {

Choose a reason for hiding this comment

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

exported method ReloaderFactory.Create should have comment or be unexported


type ReloaderFactory struct{ sched *scheduler.Scheduler }

func NewFactory(sched *scheduler.Scheduler) *ReloaderFactory {

Choose a reason for hiding this comment

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

exported function NewFactory should have comment or be unexported

Processors processors.PluginConfig `config:"processors"`
}

type ReloaderFactory struct{ sched *scheduler.Scheduler }

Choose a reason for hiding this comment

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

exported type ReloaderFactory should have comment or be unexported

Processors processors.PluginConfig `config:"processors"`
}

type MonitorsConfig []MonitorTaskConfig

Choose a reason for hiding this comment

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

exported type MonitorsConfig should have comment or be unexported

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

type MonitorTaskConfig struct {

Choose a reason for hiding this comment

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

exported type MonitorTaskConfig should have comment or be unexported

}
return bt, nil
}

func (bt *Heartbeat) Monitors() error {

Choose a reason for hiding this comment

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

exported method Heartbeat.Monitors should have comment or be unexported

type factory struct{ sched *scheduler.Scheduler }

// NewFactory takes a scheduler and creates a factory that can create Monitor objects.
func NewFactory(sched *scheduler.Scheduler) *factory {

Choose a reason for hiding this comment

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

exported func NewFactory returns unexported type *monitors.factory, which can be annoying to use

return &Factory{sched}
}

func (f *Factory) Create(p beat.Pipeline, c *common.Config, meta *common.MapStrPointer) (cfgfile.Runner, error) {

Choose a reason for hiding this comment

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

exported method Factory.Create should have comment or be unexported

@ruflin
Copy link
Member

ruflin commented Aug 21, 2018

Is it required that we remove support for the poll file or could the file polling still happening inside the Beats reloading?

An other idea to keep it more backward compatible would be to remove the poll file support from inside the reloaded configs (if this doesn't get too hacky).

}
}

type MonitorPluginAlreadyExistsError pluginBuilder

Choose a reason for hiding this comment

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

exported type MonitorPluginAlreadyExistsError should have comment or be unexported

type Type uint8

const (
ActiveMonitor Type = iota + 1

Choose a reason for hiding this comment

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

exported const ActiveMonitor should have comment (or a comment on this block) or be unexported

// monitors
type PluginBuilder func(string, *common.Config) ([]Job, error)

type Type uint8

Choose a reason for hiding this comment

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

exported type Type should have comment or be unexported

Monitors []*common.Config `config:"monitors" validate:"required"`
Scheduler Scheduler `config:"scheduler"`
Monitors []*common.Config `config:"monitors"`
ConfigMonitors *common.Config `config:"config.monitors"`
Copy link
Member

Choose a reason for hiding this comment

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

Could you update the heartbeat.reference.yml file? This should make it more obvious how the config will look like.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@andrewvc
Copy link
Contributor Author

@ruflin I think we could bring back the watch.poll file. I think from a product perspective that may be wise, though we would have to add a deprecated warning "Warning, this feature will be removed soon".

Are you thinking we'd remove it in the next major or the next minor?

I do think once we make this change we should delete all documentation of the watch.poll feature of course.

@andrewvc
Copy link
Contributor Author

@urso FYI this is ready for a preliminary review. There are no tests, but I'd appreciate your input on this approach to config file reloading.

I also took the time to refactor a lot of the existing code to simplify the data structures and control flow, as well as too make the codebase more amenable to testing.

I'm sure writing unit tests for all this code (which IMHO is a blocker for this), will change it more still, but before I get too far ahead of myself I think it'd be good to have feedback from you and @ruflin

name: zanzibar
enabled: true
urls: ["http://elastic.co"]
schedule: '@every 1s'
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this file intended? doesn't seem related to the PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no and yes. It won't go in the final one, but it's useful to keep around for manual testing for now when I switch branches.

}

func New(b *beat.Beat, cfg *common.Config) (beat.Beater, error) {
func New(b *beat.Beat, rawConfig *common.Config) (beat.Beater, error) {

Choose a reason for hiding this comment

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

exported function New should have comment or be unexported

}

func New(b *beat.Beat, cfg *common.Config) (beat.Beater, error) {
func New(b *beat.Beat, rawConfig *common.Config) (beat.Beater, error) {

Choose a reason for hiding this comment

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

exported function New should have comment or be unexported

return nil
}

// RunStaticMonitors runs the `heartbeat.config.monitors` portion of the yaml config if present.

Choose a reason for hiding this comment

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

comment on exported method Heartbeat.RunDynamicMonitors should be of the form "RunDynamicMonitors ..."

@andrewvc
Copy link
Contributor Author

FYI went through the PR again and cleaned up the code a bit more, broke up some functions a bit, and removed a few dead struct members.

Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

+1 on deprecating the poll file. This gives us the option to potentially remove it in 7.0 or also if we realise we can't fully replace it to either undeprecate it or find an other solution for it.

We should discuss if we remove it for 7.0, I would not remove it in a minor.

Not sure if we should remove the docs if we deprecated it, as the docs should also show that it is deprecated.

We should remove it from the config files.

}

// Scheduler defines the syntax of a heartbeat.yaml scheduler block.
Copy link
Member

Choose a reason for hiding this comment

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

Nit but in case I miss it later: We always use .yml (history ...)

Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

I would suggest to make sure this PR is as little as possible to move everything into separate PR's that we can merge quickly. I think there is quite a bit of renaming for example happening + plugin stuff that could go into separate PR's.

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

func Test_newPluginsReg(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

TestNewPluginsReg, I prefer not to have _ in function names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I discussed this with @urso in a previous PR. Our conclusion was that the linter doesn't complain, so this is OK. The go project itself added support for underscores since they were a requirement for doc_test.go files. In other words, they explicitly added support in the linter for underscores, but only for test files.

These names (and parts of the test bodies), were generated with https://github.com/cweill/gotests . I'm sure underscores were a consideration in the creation of that library as well.

Copy link
Member

Choose a reason for hiding this comment

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

Good to know. Didn't know about it.

}
}

func Test_pluginsReg_add(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

see above

@andrewvc
Copy link
Contributor Author

@ruflin I would love to create a more minimal PR. In general, that's my preference. However, in this case, I think a larger PR is more appropriate.

I apologize for the pain of this large PR, but I do think it's the best way forward.

The reason being that adding reload capability required substantive changes to the original code, and that modifying the original code with confidence was difficult due to it being hard to follow. Additionally, I think we need to add tests to this code. If we're adding test we are due for a refactor as well.

The original code is hard to follow in part because of naming choices and the length of functions. This is not unexpected to find in an un-unit-tested codebase. This refactor makes understanding the code more tractable. Before, reading the code, IMHO, involved keeping in one's head many similar sounding names and some unique but confusing names.

Additionally, I don't think we can merge any of this without substantive tests. The refactored code breaks up the logic more finely and makes that testing easier.

}

// RunDynamicMonitors runs the `heartbeat.config.monitors` portion of the yaml config if present.
func (bt *Heartbeat) RunDynamicMonitors(b *beat.Beat) (onDone func(), err error) {
Copy link

Choose a reason for hiding this comment

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

consider to return the monitorReloader or pass the monitorReloader.

E.g. in beater Run:

if bt.config.ConfigMonitors.Enabled() {
  reloader := cfgfile.NewReloader(...)
  err := startReloader(reloader, ...)
  if err != nil { ... }

  defer reloader.Stop() // defer has function scope
}

with

func startReloader(reloader, factory) error {
  if err := reloader.Check(factory); err != nil {
     return err
  }
  go reloader.Run(factory)
  return nil
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm a little unclear as to the why here? Is the goal to decouple the monitor creating logic from RunDynamicMonitors?

Copy link

Choose a reason for hiding this comment

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

It's more about symmetry. The function that instantiates some object which needs cleanup (Close/Stop/Cleanup...) should also clean it up (more akin to RAII). Returning some cleanup function is an edge-case that should be used sparily (e.g. teardown in test code is a common pattern). This way we end up with the common create-defer close pattern:

x := New...
defer x.Close()

returning a stop function to defer on from a method named 'RunX' just looks somewhat unexpected. ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, thanks for the heads up on that, makes sense, will change it

func (m *Monitor) makeTasks(config *common.Config, jobs []Job) error {
mtConf := monitorTaskConfig{}
if err := config.Unpack(&mtConf); err != nil {
return errors.Wrap(err, "unexpected error while configuring heartbeat job")
Copy link

Choose a reason for hiding this comment

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

It's more like an 'invalid config' error. Unpacking/parsing the config into mtConf failed due to mtConf and the configuration object passed being incompatible.


// MonitorPluginAlreadyExistsError is returned when there is an attempt to register two plugins
// with the same name.
type MonitorPluginAlreadyExistsError pluginBuilder
Copy link

Choose a reason for hiding this comment

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

Stuttering. The full type name is monitors.MonitorPluginAlreadyExistsError. Renaming it to monitors.PluginAlreadyExistsError will contain the same information.

)

// PluginsReg maintains the canonical list of valid Heartbeat monitors at runtime.
var PluginsReg = newPluginsReg()
Copy link

Choose a reason for hiding this comment

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

Let's not export this symbol.

Poll time.Duration `config:"watch.poll_file.interval" validate:"min=1"`
}

var DefaultWatchConfig = watchConfig{

Choose a reason for hiding this comment

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

exported var DefaultWatchConfig should have comment or be unexported

Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

Overall I like the direction this is going.

@@ -56,36 +64,80 @@ func New(b *beat.Beat, cfg *common.Config) (beat.Beater, error) {
return nil, err
}

sched := scheduler.NewWithLocation(limit, location)
manager, err := newMonitorManager(b.Publisher, sched, monitors.Registry, config.Monitors)
scheduler := scheduler.NewWithLocation(limit, location)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Is this error check still needed now that the newMonitorManager code is gone?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch

@@ -0,0 +1,2 @@
{"urls": ["http://blah2.elastic.co"], "schedule": "@every 10s", "name": "foobarz", "enabled": true}
Copy link
Member

Choose a reason for hiding this comment

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

I assume thats for testing purpose

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, exactly


# Maximum amount of time to randomly delay the start of a metricset. Use 0 to
# disable startup delay.
metricbeat.max_start_delay: 10s
Copy link
Member

Choose a reason for hiding this comment

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

Metricbeat?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, I think I did some copy/paste at one point.

@@ -62,6 +62,23 @@ heartbeat.monitors:
# sub-dictionary. Default is false.
#fields_under_root: false

# Config reloading allows to dynamically load monitors. Each file which is
Copy link
Member

Choose a reason for hiding this comment

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

This will probably get overwritten when you run make update. You have to modify the _meta/beat.reference.yml file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, thanks

@@ -31,7 +31,7 @@ import (
type Config struct {
Name string `config:"name"`

URLs []string `config:"urls" validate:"required"`
URLs []string `config:"urls"`
Copy link
Member

Choose a reason for hiding this comment

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

This is only not required if a poll_file is specified?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is a good point. I'll need to add in an error about that somewhere. I assume the annotations here aren't rich enough to encode that conditional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I thought I had broken this with my refactor, but currently you may not use the poll file exclusively, you must declare at least one regular host.

I'll preserve that behavior and delete this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Errr, revert it.

@@ -20,28 +20,120 @@ package monitors
import (
"errors"

"fmt"
Copy link
Member

Choose a reason for hiding this comment

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

Imports fun

mpi := MonitorPluginInfo{Enabled: true}

if err := config.Unpack(&mpi); err != nil {
return mpi, errors.Wrap(err, "Error unpacking monitor plugin config")
Copy link
Member

Choose a reason for hiding this comment

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

Nit: errors we return are normally starting lower case. I wonder why hound did not complain?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe it doesn't understand errors.Wrap?

At any rate, will fix


type jobCanceller func() error

type monitorTask struct {
Copy link
Member

Choose a reason for hiding this comment

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

Can this just be called task. Otherwise you repeat the package name. Same below for taskConfig and all the types / methods that contain monitor in the name.

Copy link

Choose a reason for hiding this comment

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

Some comment clarifying that monitorTask is used to lift monitoring jobs into the scheduler might be helpful.

config monitorTaskConfig
monitor *Monitor
processors *processors.Processors
cancelTf jobCanceller
Copy link
Member

Choose a reason for hiding this comment

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

what does Tf stand for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

taskFunc. I think it should just be called jobCancelFn

@@ -25,29 +25,37 @@ import (
"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/logp"

"github.com/pkg/errors"
Copy link
Member

Choose a reason for hiding this comment

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

Messy imports.

enabled bool
watchPollTasks []*monitorTask
watch watcher.Watch
runMtx sync.Mutex
Copy link

Choose a reason for hiding this comment

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

I guess watchPollTasks, watch, and runMtx are all related to dynamic jobs via file config watcher. Let's either distuingish them visually by adding a newline and comment or introduce a type/struct to combine watch related fields.

return
}

m.watchPollTasks = append(m.watchPollTasks, watchTasks...)
Copy link

Choose a reason for hiding this comment

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

this doesn't look thread-safe. The watcher is supposed to pickup changes while heartbeat is running. Maybe I'm missing something, but how do we make sure new tasks are started and old stopped?

Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

Almost there. Some minor comments. Could you also make hound happy?

"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/heartbeat/monitors"

"github.com/pkg/errors"
Copy link
Member

Choose a reason for hiding this comment

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

The usual import fun

manager *monitorManager
// config is used for iterating over elements of the config.
config config.Config
// rawConfig is used in places where we want to unpack the config differently.
Copy link
Member

Choose a reason for hiding this comment

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

This comment might be obsolete?

return t.prepareSchedulerJob(meta, t.job.Run)
}

func (t *task) Start() {
Copy link
Member

Choose a reason for hiding this comment

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

surprised that hound does not complain, same below

@andrewvc
Copy link
Contributor Author

andrewvc commented Sep 5, 2018

@ruflin thanks for the review I've addressed those issues in 7dabc9d

@ruflin
Copy link
Member

ruflin commented Sep 6, 2018

The failing config reload test could be related. Looks like a race. Full log output here to make sure it's not lost.

2018-09-05T16:55:44.704Z	INFO	instance/beat.go:552	Home path: [C:\Users\jenkins\workspace\elastic+beats+pull-request+multijob-windows\beat\heartbeat\label\windows\src\github.com\elastic\beats\heartbeat\build\system-tests\run\test_reload.Test.test_config_reload] Config path: [C:\Users\jenkins\workspace\elastic+beats+pull-request+multijob-windows\beat\heartbeat\label\windows\src\github.com\elastic\beats\heartbeat\build\system-tests\run\test_reload.Test.test_config_reload] Data path: [C:\Users\jenkins\workspace\elastic+beats+pull-request+multijob-windows\beat\heartbeat\label\windows\src\github.com\elastic\beats\heartbeat\build\system-tests\run\test_reload.Test.test_config_reload\data] Logs path: [C:\Users\jenkins\workspace\elastic+beats+pull-request+multijob-windows\beat\heartbeat\label\windows\src\github.com\elastic\beats\heartbeat\build\system-tests\run\test_reload.Test.test_config_reload\logs]
2018-09-05T16:55:44.704Z	DEBUG	[beat]	instance/beat.go:579	Beat metadata path: C:\Users\jenkins\workspace\elastic+beats+pull-request+multijob-windows\beat\heartbeat\label\windows\src\github.com\elastic\beats\heartbeat\build\system-tests\run\test_reload.Test.test_config_reload\data\meta.json
2018-09-05T16:55:44.713Z	INFO	instance/beat.go:559	Beat UUID: bfac63db-313c-44f8-ac69-00b76e95c5b7
2018-09-05T16:55:44.713Z	DEBUG	[seccomp]	seccomp/seccomp.go:88	Syscall filtering is only supported on Linux
2018-09-05T16:55:44.713Z	INFO	[beat]	instance/beat.go:775	Beat info	{"system_info": {"beat": {"path": {"config": "C:\\Users\\jenkins\\workspace\\elastic+beats+pull-request+multijob-windows\\beat\\heartbeat\\label\\windows\\src\\github.com\\elastic\\beats\\heartbeat\\build\\system-tests\\run\\test_reload.Test.test_config_reload", "data": "C:\\Users\\jenkins\\workspace\\elastic+beats+pull-request+multijob-windows\\beat\\heartbeat\\label\\windows\\src\\github.com\\elastic\\beats\\heartbeat\\build\\system-tests\\run\\test_reload.Test.test_config_reload\\data", "home": "C:\\Users\\jenkins\\workspace\\elastic+beats+pull-request+multijob-windows\\beat\\heartbeat\\label\\windows\\src\\github.com\\elastic\\beats\\heartbeat\\build\\system-tests\\run\\test_reload.Test.test_config_reload", "logs": "C:\\Users\\jenkins\\workspace\\elastic+beats+pull-request+multijob-windows\\beat\\heartbeat\\label\\windows\\src\\github.com\\elastic\\beats\\heartbeat\\build\\system-tests\\run\\test_reload.Test.test_config_reload\\logs"}, "type": "heartbeat", "uuid": "bfac63db-313c-44f8-ac69-00b76e95c5b7"}}}
2018-09-05T16:55:44.713Z	INFO	[beat]	instance/beat.go:784	Build info	{"system_info": {"build": {"commit": "unknown", "libbeat": "7.0.0-alpha1", "time": "1754-08-30T22:43:41.128Z", "version": "7.0.0-alpha1"}}}
2018-09-05T16:55:44.713Z	INFO	[beat]	instance/beat.go:787	Go runtime info	{"system_info": {"go": {"os":"windows","arch":"amd64","max_procs":4,"version":"go1.10.3"}}}
2018-09-05T16:55:44.720Z	INFO	[beat]	instance/beat.go:791	Host info	{"system_info": {"host": {"architecture":"x86_64","boot_time":"2018-08-29T18:03:41.69Z","hostname":"beats-ci-windows-2016-worker-576r","ips":["10.224.0.50/20","::1/128","127.0.0.1/8"],"kernel_version":"10.0.14393.2430 (rs1_release_inmarket_aim.180806-1810)","mac_addresses":["42:01:0a:e0:00:32"],"os":{"family":"windows","platform":"windows","name":"Windows Server 2016 Datacenter","version":"10.0","major":10,"minor":0,"patch":0,"build":"14393.2430"},"timezone":"GMT","timezone_offset_sec":0,"id":"0e60fdde-d700-4a43-8295-23eab5c877c6"}}}
2018-09-05T16:55:44.720Z	INFO	instance/beat.go:274	Setup Beat: heartbeat; Version: 7.0.0-alpha1
2018-09-05T16:55:44.720Z	DEBUG	[beat]	instance/beat.go:291	Initializing output plugins
2018-09-05T16:55:44.721Z	DEBUG	[processors]	processors/processor.go:66	Processors: 
2018-09-05T16:55:44.721Z	DEBUG	[rotator]	file/rotator.go:135	Initialized file rotator	{"rotator": {"filename": "C:\\Users\\jenkins\\workspace\\elastic+beats+pull-request+multijob-windows\\beat\\heartbeat\\label\\windows\\src\\github.com\\elastic\\beats\\heartbeat\\build\\system-tests\\run\\test_reload.Test.test_config_reload\\output\\heartbeat", "max_size_bytes": 10485760, "max_backups": 7, "permissions": "-rw-------"}}
2018-09-05T16:55:44.722Z	INFO	fileout/file.go:97	Initialized file output. path=C:\Users\jenkins\workspace\elastic+beats+pull-request+multijob-windows\beat\heartbeat\label\windows\src\github.com\elastic\beats\heartbeat\build\system-tests\run\test_reload.Test.test_config_reload\output\heartbeat max_size_bytes=10485760 max_backups=7 permissions=-rw-------
2018-09-05T16:55:44.723Z	DEBUG	[publish]	pipeline/consumer.go:137	start pipeline event consumer
2018-09-05T16:55:44.723Z	INFO	[publisher]	pipeline/module.go:111	Beat name: %sbeats-ci-windows-2016-worker-576r
2018-09-05T16:55:44.723Z	WARN	[cfgwarn]	beater/heartbeat.go:47	BETA: Heartbeat is beta software
2018-09-05T16:55:44.724Z	INFO	[monitoring]	log/log.go:117	Starting metrics logging every 30s
2018-09-05T16:55:44.724Z	INFO	instance/beat.go:375	heartbeat start running.
2018-09-05T16:55:44.724Z	INFO	beater/heartbeat.go:76	heartbeat is running! Hit CTRL-C to stop it.
2018-09-05T16:55:44.724Z	DEBUG	[service]	service/service_windows.go:72	Windows is interactive: false
2018-09-05T16:55:44.725Z	INFO	cfgfile/reload.go:141	Config reloader started
2018-09-05T16:55:44.725Z	INFO	service/service_windows.go:101	Attempted to register Windows service handlers, but this is not a service. No action necessary
2018-09-05T16:55:44.725Z	DEBUG	[scheduler]	scheduler/scheduler.go:168	Start scheduler.
2018-09-05T16:55:45.726Z	DEBUG	[cfgfile]	cfgfile/reload.go:167	Scan for new config files
2018-09-05T16:55:45.727Z	DEBUG	[cfgfile]	cfgfile/cfgfile.go:160	Load config from file: C:\Users\jenkins\workspace\elastic+beats+pull-request+multijob-windows\beat\heartbeat\label\windows\src\github.com\elastic\beats\heartbeat\build\system-tests\run\test_reload.Test.test_config_reload\monitors.dtest.yml
2018-09-05T16:55:45.728Z	DEBUG	[cfgfile]	cfgfile/reload.go:186	Number of module configs found: 1
2018-09-05T16:55:45.728Z	DEBUG	[reload]	cfgfile/list.go:70	Starting reload procedure, current runners: 0
2018-09-05T16:55:45.728Z	DEBUG	[reload]	cfgfile/list.go:88	Start list: 1, Stop list: 0
2018-09-05T16:55:45.729Z	DEBUG	[processors]	processors/processor.go:66	Processors: 
2018-09-05T16:55:45.729Z	DEBUG	[reload]	cfgfile/list.go:109	Starting runner: &{http %!s(*common.Config=&{{<nil> } <nil> 0xc04206b8c0}) %!s(*monitors.pluginsReg=<nil>)  %!s(*scheduler.Scheduler=&{0 true 0x1fcb360 [] 0 0xc04220e8a0 0xc04220e900 0xc04220e960 [] 0xc04220e9c0 {{} [0 0 0 0 0 0 0 0 0 0 0 0] 0}}) [%!s(*monitors.task=&{0xc04206ba20 { http 0xc042281530 {map[] false []} []} 0xc042147360 0xc04206bae0 <nil> <nil>})] %!s(bool=false) {%!s(int32=0) %!s(uint32=0)} [] <nil> %!s(*pipeline.Pipeline=&{{heartbeat heartbeat 7.0.0-alpha1 beats-ci-windows-2016-worker-576r beats-ci-windows-2016-worker-576r [191 172 99 219 49 60 68 248 172 105 0 183 110 149 197 183]} 0xc042067f60 0xc04211d730 0xc042071180 0xc0421747d0 {{0 0} true 0xc0421747d0 <nil> <nil>} 0 0 <nil> 0 {{1}} <nil> 0xc0421a44e8 0xc042174960 {map[beat:map[hostname:beats-ci-windows-2016-worker-576r version:7.0.0-alpha1 name:beats-ci-windows-2016-worker-576r] host:map[name:beats-ci-windows-2016-worker-576r]] map[] [] <nil> false false}})}
2018-09-05T16:55:45.730Z	DEBUG	[scheduler]	scheduler/scheduler.go:129	Add scheduler job 'http@http://localhost:8185'.
2018-09-05T16:55:45.730Z	DEBUG	[scheduler]	scheduler/scheduler.go:187	Next wakeup time: 2018-09-05 16:55:46.7304051 +0000 GMT
2018-09-05T16:55:46.730Z	DEBUG	[cfgfile]	cfgfile/reload.go:167	Scan for new config files
2018-09-05T16:55:46.730Z	DEBUG	[scheduler]	scheduler/scheduler.go:320	Start job 'http@http://localhost:8185' at 2018-09-05 16:55:46.7304225 +0000 GMT m=+2.123064001.
2018-09-05T16:55:46.730Z	DEBUG	[scheduler]	scheduler/scheduler.go:187	Next wakeup time: 2018-09-05 16:55:47.7304051 +0000 GMT
2018-09-05T16:55:46.731Z	DEBUG	[cfgfile]	cfgfile/cfgfile.go:160	Load config from file: C:\Users\jenkins\workspace\elastic+beats+pull-request+multijob-windows\beat\heartbeat\label\windows\src\github.com\elastic\beats\heartbeat\build\system-tests\run\test_reload.Test.test_config_reload\monitors.dtest.yml
2018-09-05T16:55:46.733Z	DEBUG	[cfgfile]	cfgfile/reload.go:186	Number of module configs found: 1
2018-09-05T16:55:46.733Z	DEBUG	[reload]	cfgfile/list.go:70	Starting reload procedure, current runners: 1
2018-09-05T16:55:46.733Z	DEBUG	[reload]	cfgfile/list.go:88	Start list: 0, Stop list: 0
2018-09-05T16:55:46.742Z	DEBUG	[publish]	pipeline/processor.go:308	Publish event: {
  "@timestamp": "2018-09-05T16:55:46.731Z",
  "@metadata": {
    "beat": "heartbeat",
    "type": "doc",
    "version": "7.0.0-alpha1"
  },
  "http": {
    "response": {
      "status_code": 200
    },
    "rtt": {
      "total": {
        "us": 2903
      },
      "write_request": {
        "us": 0
      },
      "response_header": {
        "us": 0
      },
      "validate": {
        "us": 963
      },
      "content": {
        "us": 963
      }
    },
    "url": "http://localhost:8185"
  },
  "monitor": {
    "status": "up",
    "id": "http@http://localhost:8185",
    "scheme": "http",
    "name": "http",
    "type": "http",
    "ip": "127.0.0.1",
    "host": "localhost",
    "duration": {
      "us": 9758
    }
  },
  "resolve": {
    "rtt": {
      "us": 5863
    },
    "host": "localhost",
    "ip": "127.0.0.1"
  },
  "beat": {
    "name": "beats-ci-windows-2016-worker-576r",
    "hostname": "beats-ci-windows-2016-worker-576r",
    "version": "7.0.0-alpha1"
  },
  "host": {
    "name": "beats-ci-windows-2016-worker-576r"
  },
  "tcp": {
    "port": 8185,
    "rtt": {
      "connect": {
        "us": 977
      }
    }
  }
}
2018-09-05T16:55:46.742Z	DEBUG	[scheduler]	scheduler/scheduler.go:225	Job 'http@http://localhost:8185' returned at 2018-09-05 16:55:46.7421024 +0000 GMT m=+2.134743801 (cont=0).
2018-09-05T16:55:46.742Z	DEBUG	[scheduler]	scheduler/scheduler.go:187	Next wakeup time: 2018-09-05 16:55:47.7304051 +0000 GMT
2018-09-05T16:55:46.844Z	DEBUG	[publisher]	memqueue/ackloop.go:160	ackloop: receive ack [0: 0, 1]
2018-09-05T16:55:46.844Z	DEBUG	[publisher]	memqueue/eventloop.go:535	broker ACK events: count=1, start-seq=1, end-seq=1

2018-09-05T16:55:46.844Z	DEBUG	[publisher]	memqueue/ackloop.go:128	ackloop: return ack to broker loop:1
2018-09-05T16:55:46.844Z	DEBUG	[publisher]	memqueue/ackloop.go:131	ackloop:  done send ack
2018-09-05T16:55:47.732Z	DEBUG	[scheduler]	scheduler/scheduler.go:320	Start job 'http@http://localhost:8185' at 2018-09-05 16:55:47.7323495 +0000 GMT m=+3.124984301.
2018-09-05T16:55:47.732Z	DEBUG	[scheduler]	scheduler/scheduler.go:187	Next wakeup time: 2018-09-05 16:55:48.7304051 +0000 GMT
2018-09-05T16:55:47.734Z	DEBUG	[cfgfile]	cfgfile/reload.go:167	Scan for new config files
2018-09-05T16:55:47.735Z	DEBUG	[cfgfile]	cfgfile/cfgfile.go:160	Load config from file: C:\Users\jenkins\workspace\elastic+beats+pull-request+multijob-windows\beat\heartbeat\label\windows\src\github.com\elastic\beats\heartbeat\build\system-tests\run\test_reload.Test.test_config_reload\monitors.dtest.yml
2018-09-05T16:55:47.736Z	DEBUG	[cfgfile]	cfgfile/reload.go:186	Number of module configs found: 1
2018-09-05T16:55:47.736Z	DEBUG	[reload]	cfgfile/list.go:70	Starting reload procedure, current runners: 1
2018-09-05T16:55:47.737Z	DEBUG	[reload]	cfgfile/list.go:88	Start list: 1, Stop list: 1
2018-09-05T16:55:47.737Z	DEBUG	[reload]	cfgfile/list.go:92	Stopping runner: &{http %!s(*common.Config=&{{<nil> } <nil> 0xc04206b8c0}) %!s(*monitors.pluginsReg=<nil>)  %!s(*scheduler.Scheduler=&{0 true 0x1fcb360 [0xc042174be0] 1 0xc04220e8a0 0xc04220e900 0xc04220e960 [] 0xc04220e9c0 {{} [0 0 0 0 0 0 0 0 0 0 0 0] 0}}) [%!s(*monitors.task=&{0xc04206ba20 { http 0xc042281530 {map[] false []} []} 0xc042147360 0xc04206bae0 0x928d10 0xc0423ac0c0})] %!s(bool=false) {%!s(int32=0) %!s(uint32=0)} [] <nil> %!s(*pipeline.Pipeline=&{{heartbeat heartbeat 7.0.0-alpha1 beats-ci-windows-2016-worker-576r beats-ci-windows-2016-worker-576r [191 172 99 219 49 60 68 248 172 105 0 183 110 149 197 183]} 0xc042067f60 0xc04211d730 0xc042071180 0xc0421747d0 {{0 0} false 0xc0421747d0 <nil> <nil>} 0 0 <nil> 0 {{1}} <nil> 0xc0421a44e8 0xc042174960 {map[beat:map[name:beats-ci-windows-2016-worker-576r hostname:beats-ci-windows-2016-worker-576r version:7.0.0-alpha1] host:map[name:beats-ci-windows-2016-worker-576r]] map[] [] <nil> false false}})}
2018-09-05T16:55:47.737Z	DEBUG	[scheduler]	scheduler/scheduler.go:148	Remove scheduler job 'http@http://localhost:8185'
2018-09-05T16:55:47.738Z	DEBUG	[publish]	pipeline/client.go:148	client: closing acker
2018-09-05T16:55:47.738Z	DEBUG	[publish]	pipeline/client.go:150	client: done closing acker
2018-09-05T16:55:47.738Z	DEBUG	[publish]	pipeline/client.go:154	client: cancelled 0 events
2018-09-05T16:55:47.738Z	DEBUG	[publish]	pipeline/processor.go:308	Publish event: {
  "@timestamp": "2018-09-05T16:55:47.732Z",
  "@metadata": {
    "beat": "heartbeat",
    "type": "doc",
    "version": "7.0.0-alpha1"
  },
  "host": {
    "name": "beats-ci-windows-2016-worker-576r"
  },
  "resolve": {
    "host": "localhost",
    "ip": "127.0.0.1",
    "rtt": {
      "us": 1950
    }
  },
  "monitor": {
    "status": "up",
    "id": "http@http://localhost:8185",
    "scheme": "http",
    "name": "http",
    "type": "http",
    "ip": "127.0.0.1",
    "host": "localhost",
    "duration": {
      "us": 4872
    }
  },
  "tcp": {
    "port": 8185,
    "rtt": {
      "connect": {
        "us": 972
      }
    }
  },
  "http": {
    "rtt": {
      "content": {
        "us": 0
      },
      "total": {
        "us": 1946
      },
      "write_request": {
        "us": 0
      },
      "response_header": {
        "us": 973
      },
      "validate": {
        "us": 973
      }
    },
    "url": "http://localhost:8185",
    "response": {
      "status_code": 200
    }
  },
  "beat": {
    "name": "beats-ci-windows-2016-worker-576r",
    "hostname": "beats-ci-windows-2016-worker-576r",
    "version": "7.0.0-alpha1"
  }
}
2018-09-05T16:55:47.738Z	DEBUG	[processors]	processors/processor.go:66	Processors: 
2018-09-05T16:55:47.738Z	DEBUG	[scheduler]	scheduler/scheduler.go:225	Job 'http@http://localhost:8185' returned at 2018-09-05 16:55:47.7382028 +0000 GMT m=+3.130837601 (cont=0).
==================
WARNING: DATA RACE
Read at 0x00c0421cf4b0 by goroutine 37:
  reflect.Value.Uint()
      C:/Users/jenkins.BEATS-CI-WINDOW/.gvm/versions/go1.10.3.windows.amd64/src/reflect/value.go:1748 +0x137
  fmt.(*pp).printValue()
      C:/Users/jenkins.BEATS-CI-WINDOW/.gvm/versions/go1.10.3.windows.amd64/src/fmt/print.go:724 +0x348e
  fmt.(*pp).printValue()
      C:/Users/jenkins.BEATS-CI-WINDOW/.gvm/versions/go1.10.3.windows.amd64/src/fmt/print.go:783 +0x278f
  fmt.(*pp).printValue()
      C:/Users/jenkins.BEATS-CI-WINDOW/.gvm/versions/go1.10.3.windows.amd64/src/fmt/print.go:853 +0x2557
  fmt.(*pp).badVerb()
      C:/Users/jenkins.BEATS-CI-WINDOW/.gvm/versions/go1.10.3.windows.amd64/src/fmt/print.go:333 +0x8f9
  fmt.(*pp).fmtPointer()
      C:/Users/jenkins.BEATS-CI-WINDOW/.gvm/versions/go1.10.3.windows.amd64/src/fmt/print.go:526 +0xe1
  fmt.(*pp).printValue()
      C:/Users/jenkins.BEATS-CI-WINDOW/.gvm/versions/go1.10.3.windows.amd64/src/fmt/print.go:859 +0x1108
  fmt.(*pp).printValue()
      C:/Users/jenkins.BEATS-CI-WINDOW/.gvm/versions/go1.10.3.windows.amd64/src/fmt/print.go:783 +0x278f
  fmt.(*pp).printValue()
      C:/Users/jenkins.BEATS-CI-WINDOW/.gvm/versions/go1.10.3.windows.amd64/src/fmt/print.go:853 +0x2557
  fmt.(*pp).printArg()
      C:/Users/jenkins.BEATS-CI-WINDOW/.gvm/versions/go1.10.3.windows.amd64/src/fmt/print.go:689 +0x199
  fmt.(*pp).doPrintf()
      C:/Users/jenkins.BEATS-CI-WINDOW/.gvm/versions/go1.10.3.windows.amd64/src/fmt/print.go:1003 +0x317
  fmt.Sprintf()
      C:/Users/jenkins.BEATS-CI-WINDOW/.gvm/versions/go1.10.3.windows.amd64/src/fmt/print.go:203 +0x7a
  github.com/elastic/beats/vendor/go.uber.org/zap.(*SugaredLogger).log()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/vendor/go.uber.org/zap/sugar.go:230 +0x170
  github.com/elastic/beats/vendor/go.uber.org/zap.(*SugaredLogger).Debugf()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/vendor/go.uber.org/zap/sugar.go:133 +0x91
  github.com/elastic/beats/libbeat/logp.(*Logger).Debugf()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/libbeat/logp/logger.go:112 +0x8b
  github.com/elastic/beats/libbeat/cfgfile.(*RunnerList).Reload()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/libbeat/cfgfile/list.go:109 +0xe26
  github.com/elastic/beats/libbeat/cfgfile.(*Reloader).Run()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/libbeat/cfgfile/reload.go:188 +0x558

Previous write at 0x00c0421cf4b0 by goroutine 38:
  github.com/elastic/beats/heartbeat/scheduler.(*Scheduler).run()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/heartbeat/scheduler/scheduler.go:223 +0xa68

Goroutine 37 (running) created at:
  github.com/elastic/beats/heartbeat/beater.(*Heartbeat).RunDynamicMonitors()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/heartbeat/beater/heartbeat.go:128 +0x175
  github.com/elastic/beats/heartbeat/beater.(*Heartbeat).Run()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/heartbeat/beater/heartbeat.go:87 +0x3ab
  github.com/elastic/beats/libbeat/cmd/instance.(*Beat).launch()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:381 +0x5e3
  github.com/elastic/beats/libbeat/cmd/instance.Run.func1()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:189 +0x6f7
  github.com/elastic/beats/libbeat/cmd/instance.Run()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:190 +0x8b
  github.com/elastic/beats/libbeat/cmd.genRunCmd.func1()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/libbeat/cmd/run.go:36 +0x82
  github.com/elastic/beats/vendor/github.com/spf13/cobra.(*Command).execute()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/vendor/github.com/spf13/cobra/command.go:704 +0x888
  github.com/elastic/beats/vendor/github.com/spf13/cobra.(*Command).ExecuteC()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/vendor/github.com/spf13/cobra/command.go:785 +0x41b
  github.com/elastic/beats/vendor/github.com/spf13/cobra.(*Command).Execute()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/vendor/github.com/spf13/cobra/command.go:738 +0x3f
  github.com/elastic/beats/heartbeat.main()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/heartbeat/main.go:29 +0x6f
  github.com/elastic/beats/heartbeat.TestSystem()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/heartbeat/main_test.go:40 +0x73
  testing.tRunner()
      C:/Users/jenkins.BEATS-CI-WINDOW/.gvm/versions/go1.10.3.windows.amd64/src/testing/testing.go:777 +0x174

Goroutine 38 (running) created at:
  github.com/elastic/beats/heartbeat/scheduler.(*Scheduler).Start()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/heartbeat/scheduler/scheduler.go:113 +0x150
  github.com/elastic/beats/heartbeat/beater.(*Heartbeat).Run()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/heartbeat/beater/heartbeat.go:93 +0x154
  github.com/elastic/beats/libbeat/cmd/instance.(*Beat).launch()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:381 +0x5e3
  github.com/elastic/beats/libbeat/cmd/instance.Run.func1()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:189 +0x6f7
  github.com/elastic/beats/libbeat/cmd/instance.Run()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:190 +0x8b
  github.com/elastic/beats/libbeat/cmd.genRunCmd.func1()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/libbeat/cmd/run.go:36 +0x82
  github.com/elastic/beats/vendor/github.com/spf13/cobra.(*Command).execute()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/vendor/github.com/spf13/cobra/command.go:704 +0x888
  github.com/elastic/beats/vendor/github.com/spf13/cobra.(*Command).ExecuteC()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/vendor/github.com/spf13/cobra/command.go:785 +0x41b
  github.com/elastic/beats/vendor/github.com/spf13/cobra.(*Command).Execute()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/vendor/github.com/spf13/cobra/command.go:738 +0x3f
  github.com/elastic/beats/heartbeat.main()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/heartbeat/main.go:29 +0x6f
  github.com/elastic/beats/heartbeat.TestSystem()
      C:/Users/jenkins/workspace/elastic+beats+pull-request+multijob-windows/beat/heartbeat/label/windows/src/github.com/elastic/beats/heartbeat/main_test.go:40 +0x73
  testing.tRunner()
      C:/Users/jenkins.BEATS-CI-WINDOW/.gvm/versions/go1.10.3.windows.amd64/src/testing/testing.go:777 +0x174
==================
2018-09-05T16:55:47.739Z	DEBUG	[reload]	cfgfile/list.go:109	Starting runner: &{http %!s(*common.Config=&{{<nil> } <nil> 0xc042438740}) %!s(*monitors.pluginsReg=<nil>)  %!s(*scheduler.Scheduler=&{0 true 0x1fcb360 [] 0 0xc04220e8a0 0xc04220e900 0xc04220e960 [] 0xc04220e9c0 {{} [0 0 0 0 0 0 0 0 0 0 0 0] 0}}) [%!s(*monitors.task=&{0xc042438860 { http 0xc04243afc0 {map[] false []} []} 0xc0422e8140 0xc0424388e0 <nil> <nil>})] %!s(bool=false) {%!s(int32=0) %!s(uint32=0)} [] <nil> %!s(*pipeline.Pipeline=&{{heartbeat heartbeat 7.0.0-alpha1 beats-ci-windows-2016-worker-576r beats-ci-windows-2016-worker-576r [191 172 99 219 49 60 68 248 172 105 0 183 110 149 197 183]} 0xc042067f60 0xc04211d730 0xc042071180 0xc0421747d0 {{0 0} false 0xc0421747d0 <nil> <nil>} 0 0 <nil> 0 {{1}} <nil> 0xc0421a44e8 0xc042174960 {map[beat:map[name:beats-ci-windows-2016-worker-576r hostname:beats-ci-windows-2016-worker-576r version:7.0.0-alpha1] host:map[name:beats-ci-windows-2016-worker-576r]] map[] [] <nil> false false}})}
2018-09-05T16:55:47.740Z	DEBUG	[scheduler]	scheduler/scheduler.go:129	Add scheduler job 'http@http://localhost:8186'.
2018-09-05T16:55:47.740Z	DEBUG	[scheduler]	scheduler/scheduler.go:187	Next wakeup time: 2018-09-05 16:55:48.7401815 +0000 GMT
2018-09-05T16:55:47.838Z	DEBUG	[publisher]	memqueue/ackloop.go:160	ackloop: receive ack [1: 0, 1]
2018-09-05T16:55:47.839Z	DEBUG	[publisher]	memqueue/eventloop.go:535	broker ACK events: count=1, start-seq=2, end-seq=2

2018-09-05T16:55:47.839Z	DEBUG	[publisher]	memqueue/ackloop.go:128	ackloop: return ack to broker loop:1
2018-09-05T16:55:47.839Z	DEBUG	[publisher]	memqueue/ackloop.go:131	ackloop:  done send ack
2018-09-05T16:55:48.741Z	DEBUG	[cfgfile]	cfgfile/reload.go:167	Scan for new config files
2018-09-05T16:55:48.741Z	DEBUG	[scheduler]	scheduler/scheduler.go:320	Start job 'http@http://localhost:8186' at 2018-09-05 16:55:48.7411375 +0000 GMT m=+4.133765501.
2018-09-05T16:55:48.741Z	DEBUG	[scheduler]	scheduler/scheduler.go:187	Next wakeup time: 2018-09-05 16:55:49.7401815 +0000 GMT
2018-09-05T16:55:48.742Z	DEBUG	[cfgfile]	cfgfile/cfgfile.go:160	Load config from file: C:\Users\jenkins\workspace\elastic+beats+pull-request+multijob-windows\beat\heartbeat\label\windows\src\github.com\elastic\beats\heartbeat\build\system-tests\run\test_reload.Test.test_config_reload\monitors.dtest.yml
2018-09-05T16:55:48.743Z	DEBUG	[cfgfile]	cfgfile/reload.go:186	Number of module configs found: 1
2018-09-05T16:55:48.743Z	DEBUG	[reload]	cfgfile/list.go:70	Starting reload procedure, current runners: 1
2018-09-05T16:55:48.743Z	DEBUG	[reload]	cfgfile/list.go:88	Start list: 0, Stop list: 0
2018-09-05T16:55:49.741Z	DEBUG	[scheduler]	scheduler/scheduler.go:208	Scheduled job 'http@http://localhost:8186' still active.
2018-09-05T16:55:49.741Z	INFO	scheduler/scheduler.go:311	Scheduled job 'http@http://localhost:8186' already active.
2018-09-05T16:55:49.741Z	DEBUG	[scheduler]	scheduler/scheduler.go:187	Next wakeup time: 2018-09-05 16:55:50.7401815 +0000 GMT
2018-09-05T16:55:49.744Z	DEBUG	[cfgfile]	cfgfile/reload.go:167	Scan for new config files
2018-09-05T16:55:49.745Z	DEBUG	[cfgfile]	cfgfile/cfgfile.go:160	Load config from file: C:\Users\jenkins\workspace\elastic+beats+pull-request+multijob-windows\beat\heartbeat\label\windows\src\github.com\elastic\beats\heartbeat\build\system-tests\run\test_reload.Test.test_config_reload\monitors.dtest.yml
2018-09-05T16:55:49.746Z	DEBUG	[cfgfile]	cfgfile/reload.go:186	Number of module configs found: 1
2018-09-05T16:55:49.746Z	DEBUG	[reload]	cfgfile/list.go:70	Starting reload procedure, current runners: 1
2018-09-05T16:55:49.746Z	DEBUG	[publish]	pipeline/processor.go:308	Publish event: {
  "@timestamp": "2018-09-05T16:55:48.741Z",
  "@metadata": {
    "beat": "heartbeat",
    "type": "doc",
    "version": "7.0.0-alpha1"
  },
  "host": {
    "name": "beats-ci-windows-2016-worker-576r"
  },
  "http": {
    "url": "http://localhost:8186"
  },
  "resolve": {
    "rtt": {
      "us": 994
    },
    "host": "localhost",
    "ip": "127.0.0.1"
  },
  "error": {
    "message": "Get http://localhost:8186: dial tcp 127.0.0.1:8186: connectex: No connection could be made because the target machine actively refused it.",
    "type": "io"
  },
  "tcp": {
    "port": 8186
  },
  "monitor": {
    "id": "http@http://localhost:8186",
    "name": "http",
    "type": "http",
    "host": "localhost",
    "ip": "127.0.0.1",
    "duration": {
      "us": 1003917
    },
    "status": "down",
    "scheme": "http"
  },
  "beat": {
    "name": "beats-ci-windows-2016-worker-576r",
    "hostname": "beats-ci-windows-2016-worker-576r",
    "version": "7.0.0-alpha1"
  }
}
2018-09-05T16:55:49.746Z	DEBUG	[reload]	cfgfile/list.go:88	Start list: 0, Stop list: 0
2018-09-05T16:55:49.746Z	DEBUG	[scheduler]	scheduler/scheduler.go:225	Job 'http@http://localhost:8186' returned at 2018-09-05 16:55:49.7460281 +0000 GMT m=+5.138649501 (cont=0).
2018-09-05T16:55:49.746Z	DEBUG	[scheduler]	scheduler/scheduler.go:187	Next wakeup time: 2018-09-05 16:55:50.7401815 +0000 GMT
2018-09-05T16:55:49.846Z	DEBUG	[publisher]	memqueue/ackloop.go:160	ackloop: receive ack [2: 0, 1]
2018-09-05T16:55:49.847Z	DEBUG	[publisher]	memqueue/eventloop.go:535	broker ACK events: count=1, start-seq=1, end-seq=1

2018-09-05T16:55:49.847Z	DEBUG	[publisher]	memqueue/ackloop.go:128	ackloop: return ack to broker loop:1
2018-09-05T16:55:49.847Z	DEBUG	[publisher]	memqueue/ackloop.go:131	ackloop:  done send ack
2018-09-05T16:55:49.869Z	DEBUG	[service]	service/service.go:51	Received sigterm/sigint, stopping
2018-09-05T16:55:49.869Z	INFO	beater/heartbeat.go:100	Shutting down.
2018-09-05T16:55:49.869Z	INFO	cfgfile/reload.go:163	Dynamic config reloader stopped
2018-09-05T16:55:49.870Z	DEBUG	[scheduler]	scheduler/scheduler.go:303	done
2018-09-05T16:55:49.870Z	INFO	[reload]	cfgfile/list.go:126	Stopping 1 runners ...
2018-09-05T16:55:49.870Z	DEBUG	[scheduler]	scheduler/scheduler.go:304	Scheduler stopped.
2018-09-05T16:55:49.870Z	DEBUG	[reload]	cfgfile/list.go:137	Stopping runner: &{http %!s(*common.Config=&{{<nil> } <nil> 0xc042438740}) %!s(*monitors.pluginsReg=<nil>)  %!s(*scheduler.Scheduler=&{0 false 0x1fcb360 [0xc0420ca4b0] 0 0xc04220e8a0 0xc04220e900 0xc04220e960 [] 0xc04220e9c0 {{} [0 0 0 0 0 0 0 0 0 0 0 0] 0}}) [%!s(*monitors.task=&{0xc042438860 { http 0xc04243afc0 {map[] false []} []} 0xc0422e8140 0xc0424388e0 0x928d10 0xc04225d2c0})] %!s(bool=false) {%!s(int32=0) %!s(uint32=0)} [] <nil> %!s(*pipeline.Pipeline=&{{heartbeat heartbeat 7.0.0-alpha1 beats-ci-windows-2016-worker-576r beats-ci-windows-2016-worker-576r [191 172 99 219 49 60 68 248 172 105 0 183 110 149 197 183]} 0xc042067f60 0xc04211d730 0xc042071180 0xc0421747d0 {{0 0} false 0xc0421747d0 <nil> <nil>} 0 0 <nil> 0 {{1}} <nil> 0xc0421a44e8 0xc042174960 {map[beat:map[hostname:beats-ci-windows-2016-worker-576r version:7.0.0-alpha1 name:beats-ci-windows-2016-worker-576r] host:map[name:beats-ci-windows-2016-worker-576r]] map[] [] <nil> false false}})}
2018-09-05T16:55:49.870Z	DEBUG	[scheduler]	scheduler/scheduler.go:148	Remove scheduler job 'http@http://localhost:8186'
2018-09-05T16:55:49.870Z	DEBUG	[publish]	pipeline/client.go:148	client: closing acker
2018-09-05T16:55:49.871Z	DEBUG	[publish]	pipeline/client.go:150	client: done closing acker
2018-09-05T16:55:49.871Z	DEBUG	[publish]	pipeline/client.go:154	client: cancelled 0 events
2018-09-05T16:55:49.871Z	DEBUG	[reload]	cfgfile/list.go:139	Stopped runner: &{http %!s(*common.Config=&{{<nil> } <nil> 0xc042438740}) %!s(*monitors.pluginsReg=<nil>)  %!s(*scheduler.Scheduler=&{0 false 0x1fcb360 [] 0 0xc04220e8a0 0xc04220e900 0xc04220e960 [] 0xc04220e9c0 {{} [0 0 0 0 0 0 0 0 0 0 0 0] 0}}) [%!s(*monitors.task=&{0xc042438860 { http 0xc04243afc0 {map[] false []} []} 0xc0422e8140 0xc0424388e0 0x928d10 0xc04225d2c0})] %!s(bool=false) {%!s(int32=0) %!s(uint32=0)} [] <nil> %!s(*pipeline.Pipeline=&{{heartbeat heartbeat 7.0.0-alpha1 beats-ci-windows-2016-worker-576r beats-ci-windows-2016-worker-576r [191 172 99 219 49 60 68 248 172 105 0 183 110 149 197 183]} 0xc042067f60 0xc04211d730 0xc042071180 0xc0421747d0 {{0 0} false 0xc0421747d0 <nil> <nil>} 0 0 <nil> 0 {{1}} <nil> 0xc0421a44e8 0xc042174960 {map[beat:map[hostname:beats-ci-windows-2016-worker-576r version:7.0.0-alpha1 name:beats-ci-windows-2016-worker-576r] host:map[name:beats-ci-windows-2016-worker-576r]] map[] [] <nil> false false}})}
2018-09-05T16:55:49.937Z	INFO	[monitoring]	log/log.go:152	Total non-zero metrics	{"monitoring": {"metrics": {"beat":{"cpu":{"system":{"ticks":62,"time":{"ms":62}},"total":{"ticks":140,"time":{"ms":140},"value":140},"user":{"ticks":78,"time":{"ms":78}}},"info":{"ephemeral_id":"6d346961-3bdc-4bcb-822d-0b55d0fe5d44","uptime":{"ms":5245}},"memstats":{"gc_next":4194304,"memory_alloc":2467424,"memory_total":3859328,"rss":48394240}},"libbeat":{"config":{"module":{"running":0},"reloads":5},"output":{"events":{"acked":3,"batches":3,"total":3},"type":"file","write":{"bytes":2274}},"pipeline":{"clients":0,"events":{"active":0,"published":3,"total":3},"queue":{"acked":3}}},"system":{"cpu":{"cores":4}}}}}
2018-09-05T16:55:49.938Z	INFO	[monitoring]	log/log.go:153	Uptime: 5.3124919s
2018-09-05T16:55:49.938Z	INFO	[monitoring]	log/log.go:130	Stopping metrics logging.
2018-09-05T16:55:49.938Z	INFO	instance/beat.go:381	heartbeat stopped.
--- FAIL: TestSystem (5.25s)
	testing.go:730: race detected during execution of test
FAIL
coverage: 36.2% of statements in github.com/elastic/beats/heartbeat, github.com/elastic/beats/heartbeat/beater, github.com/elastic/beats/heartbeat/cmd, github.com/elastic/beats/heartbeat/config, github.com/elastic/beats/heartbeat/hbtest, github.com/elastic/beats/heartbeat/include, github.com/elastic/beats/heartbeat/look, github.com/elastic/beats/heartbeat/monitors, github.com/elastic/beats/heartbeat/monitors/active/dialchain, github.com/elastic/beats/heartbeat/monitors/active/http, github.com/elastic/beats/heartbeat/monitors/active/icmp, github.com/elastic/beats/heartbeat/monitors/active/tcp, github.com/elastic/beats/heartbeat/monitors/defaults, github.com/elastic/beats/heartbeat/reason, github.com/elastic/beats/heartbeat/scheduler, github.com/elastic/beats/heartbeat/scheduler/schedule, github.com/elastic/beats/heartbeat/scheduler/schedule/cron, github.com/elastic/beats/heartbeat/scripts/generate_monitor, github.com/elastic/beats/heartbeat/watcher

@andrewvc
Copy link
Contributor Author

@ruflin rebased, and fix for race added in 8e8a8a3 . This was a bit of a weird one, the cause was a %s in a Debugf statement in cfgfile/reload that recursively printed structs, including a variable that was used by a background goroutine.

The race wasn't 'real', beyond that. The fix, which @andrewkroh agreed with after a discussion, was to modify the interface for Runner to include fmt.Stringer. The idea being that all Runner implementations need a consciously implemented String() string function.

@andrewvc
Copy link
Contributor Author

@urso / @exekias since @ruflin is on vacation for a while would one of you be able to help move this PR forward?

Not sure what the normal protocol is here.

Copy link
Contributor

@exekias exekias left a comment

Choose a reason for hiding this comment

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

LGTM, great work done here, it will enable heartbeat to be even more awesome in 6.5! 🎉

@andrewvc I think you can move this PR forward as @ruflin is not around, you can address any other comment he may have in future PRs.

Also, I left a comment about dynamic meta fields, but I think that can be done later, which will make reviews simpler.

}

// Create makes a new Runner for a new monitor with the given Config.
func (f *RunnerFactory) Create(p beat.Pipeline, c *common.Config, meta *common.MapStrPointer) (cfgfile.Runner, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would not do it on this PR, but you can pass meta to the ConnectWith call (DynamicFields field). This will be useful if you integrate autodiscover, as it will pass metadata from the provider (docker, kubernetes, etc) and enrich all events from the monitor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

++

@exekias
Copy link
Contributor

exekias commented Sep 13, 2018

@andrewvc can you please add a changelog entry?

@andrewvc
Copy link
Contributor Author

@exekias thanks so much for the review! I just pushed the changelog entry. I'll open a new PR once this is merged for autodiscovery, and the metadata will go with that.

@andrewvc andrewvc merged commit 037a4f2 into elastic:master Sep 14, 2018
andrewvc added a commit to andrewvc/beats that referenced this pull request Sep 14, 2018
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)
andrewvc added a commit that referenced this pull request Sep 17, 2018
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)
@urso urso mentioned this pull request Sep 17, 2018
12 tasks
andrewvc added a commit that referenced this pull request Sep 21, 2018
Docs for the changes in #8023 for heartbeat automatic reloading.
andrewvc added a commit to andrewvc/beats that referenced this pull request Sep 21, 2018
Docs for the changes in elastic#8023 for heartbeat automatic reloading.

(cherry picked from commit 04597c8)
andrewvc added a commit that referenced this pull request Sep 27, 2018
Docs for the changes in #8023 for heartbeat automatic reloading.

(cherry picked from commit 04597c8)
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.

5 participants