From 5b91cd80da34100747df7a05944632f3cd332397 Mon Sep 17 00:00:00 2001 From: mohit Date: Tue, 12 Sep 2017 04:33:05 +0000 Subject: [PATCH] DefaultCounters to log 0 for counter stats this makes sure that we can get metrics when things are not flowing through one of the consumers --- batchconsumer/stats/stats.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/batchconsumer/stats/stats.go b/batchconsumer/stats/stats.go index 0eaccf2..947dbe4 100644 --- a/batchconsumer/stats/stats.go +++ b/batchconsumer/stats/stats.go @@ -8,6 +8,19 @@ import ( var log = logger.New("amazon-kinesis-client-go") +// DefaultCounters are core counters tracked by the batchconsumer +// These are stats we want to report on every tick, even if the values are zero +var DefaultCounters = []string{ + "batches-sent", + "checkpoints-sent", + "msg-batched", + "batch-log-failures", + "unknown-error", + "processed-messages", + "no-tags", + "black-tag", +} + type datum struct { name string value int @@ -32,6 +45,9 @@ func init() { } case <-tick: tmp := logger.M{} + for _, k := range DefaultCounters { + tmp[k] = 0 + } for k, v := range data { tmp[k] = v }