Skip to content

Commit

Permalink
Add uptime value to metric reporting (#2464)
Browse files Browse the repository at this point in the history
This metric can be useful in combination with #2456 to track how long the harvesting of a file took. Uptime is reported before shutdown.
  • Loading branch information
ruflin authored and tsg committed Sep 6, 2016
1 parent 7b104f7 commit 7ec0f82
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions libbeat/logp/logp.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@ import (
"github.com/elastic/beats/libbeat/paths"
)

// cmd line flags
var verbose *bool
var toStderr *bool
var debugSelectorsStr *string
var (
// cmd line flags
verbose *bool
toStderr *bool
debugSelectorsStr *string

// Beat start time
startTime time.Time
)

func init() {
startTime = time.Now()
}

type Logging struct {
Selectors []string
Expand Down Expand Up @@ -234,4 +243,5 @@ func LogTotalExpvars(cfg *Logging) {
snapshotExpvars(vals)
metrics := buildMetricsOutput(prevVals, vals)
Info("Total non-zero values: %s", metrics)
Info("Uptime: %s", time.Now().Sub(startTime))
}

0 comments on commit 7ec0f82

Please sign in to comment.