0.3.6
This commit is contained in:
1 parent
c85c9fc144
commit
50b53e72f0
5 files changed
+21
-2
No files matched your search
+11
-1
@@ -66,14 +66,24 @@ func collect(ctx context.Context, cfg config.Config, tq *ts3.Query, rm *rrd.Mana
|
||||
// more than it reads as useful information -- so, deliberately,
|
||||
// a true "server went empty for a while" no longer shows as 0 in
|
||||
// the graph, same trade-off the original app made.
|
||||
raw := n
|
||||
if n == 0 {
|
||||
c2, cancel2 := context.WithTimeout(ctx, 2*time.Second)
|
||||
last, lastErr := rm.Last(c2)
|
||||
cancel2()
|
||||
if lastErr == nil {
|
||||
if lastErr != nil {
|
||||
log.Printf("collect: raw=0, rrd lastupdate failed (writing raw 0): %v", lastErr)
|
||||
} else {
|
||||
n = last
|
||||
}
|
||||
}
|
||||
// DEBUG=1 turns on a log line for every single collection cycle
|
||||
// (raw TS3 reading vs. what actually got written to the RRD) --
|
||||
// useful while diagnosing the stats collector, far too noisy to
|
||||
// leave on permanently (one line per STATS_INTERVAL, forever).
|
||||
if cfg.Debug {
|
||||
log.Printf("collect: raw=%d written=%d", raw, n)
|
||||
}
|
||||
c3, cancel3 := context.WithTimeout(ctx, 5*time.Second)
|
||||
defer cancel3()
|
||||
if err := rm.Update(c3, n); err != nil {
|
||||
|
||||
Reference in new issue
Block a user