Skip to content

Commit

Permalink
Fix wrong timestamp in heartbeat events
Browse files Browse the repository at this point in the history
  • Loading branch information
urso committed Aug 10, 2017
1 parent 6c5f3b2 commit 91b8b10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ https://github.com/elastic/beats/compare/v6.0.0-beta1...master[Check the HEAD di
*Heartbeat*

- Fix monitor.name being empty by default. {issue}4852[4852]
- Fix wrong event timestamps. {issue}4851[4851]

*Metricbeat*

Expand Down
12 changes: 5 additions & 7 deletions heartbeat/monitors/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ func MakeJob(settings JobSettings, f func() (common.MapStr, []TaskRunner, error)
},
})

return &funcJob{settings, annotated(settings, time.Now(), f)}
return &funcJob{settings, func() (beat.Event, []JobRunner, error) {
// Create and run new annotated Job whenever the Jobs root is Task is executed.
// This will set the jobs active start timestamp to the time.Now().
return annotated(settings, time.Now(), f)()
}}
}

// annotated lifts a TaskRunner into a job, annotating events with common fields and start timestamp.
Expand Down Expand Up @@ -406,12 +410,6 @@ func (f *funcJob) Run() (beat.Event, []JobRunner, error) { return f.run() }

func (f funcTask) Run() (common.MapStr, []TaskRunner, error) { return f.run() }

/*
func (f funcTask) annotated(settings JobSettings, start time.Time) TaskRunner {
return annotated(settings, start, f.run)
}
*/

// Unpack sets PingMode from a constant string. Unpack will be called by common.Unpack when
// unpacking into an IPSettings type.
func (p *PingMode) Unpack(s string) error {
Expand Down

0 comments on commit 91b8b10

Please sign in to comment.