Add more logging to telegraf
This commit is contained in:
parent
cd7468f3be
commit
f6f45881da
10
agent.go
10
agent.go
|
@ -177,12 +177,15 @@ func (a *Agent) crankParallel() error {
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
|
start := time.Now()
|
||||||
|
counter := 0
|
||||||
for _, plugin := range a.plugins {
|
for _, plugin := range a.plugins {
|
||||||
if plugin.config.Interval != 0 {
|
if plugin.config.Interval != 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
counter++
|
||||||
go func(plugin *runningPlugin) {
|
go func(plugin *runningPlugin) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
||||||
|
@ -216,6 +219,9 @@ func (a *Agent) crankParallel() error {
|
||||||
bp.Points = append(bp.Points, sub.Points...)
|
bp.Points = append(bp.Points, sub.Points...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elapsed := time.Since(start)
|
||||||
|
log.Printf("Cranking default interval, gathered %d metrics from %d plugins in %s\n",
|
||||||
|
len(bp.Points), counter, elapsed)
|
||||||
return a.flush(&bp)
|
return a.flush(&bp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,6 +258,7 @@ func (a *Agent) crankSeparate(shutdown chan struct{}, plugin *runningPlugin) err
|
||||||
for {
|
for {
|
||||||
var bp BatchPoints
|
var bp BatchPoints
|
||||||
var outerr error
|
var outerr error
|
||||||
|
start := time.Now()
|
||||||
|
|
||||||
bp.Debug = a.Debug
|
bp.Debug = a.Debug
|
||||||
|
|
||||||
|
@ -270,6 +277,9 @@ func (a *Agent) crankSeparate(shutdown chan struct{}, plugin *runningPlugin) err
|
||||||
bp.Time = bp.Time.UTC()
|
bp.Time = bp.Time.UTC()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elapsed := time.Since(start)
|
||||||
|
log.Printf("Cranking separate interval, gathered %d metrics from %s in %s\n",
|
||||||
|
len(bp.Points), plugin.name, elapsed)
|
||||||
if err := a.flush(&bp); err != nil {
|
if err := a.flush(&bp); err != nil {
|
||||||
outerr = errors.New("Error encountered processing plugins & outputs")
|
outerr = errors.New("Error encountered processing plugins & outputs")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue