diff options
| author | Shulhan <ms@kilabit.info> | 2019-01-25 00:43:13 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2019-01-25 00:43:13 +0700 |
| commit | 0140ce11c7f3a2b5792c545a60aa34c90fdefb61 (patch) | |
| tree | e7f7e81c1c2a3a0dd40bbc4cf61b5e66dcdb1340 /haminer.go | |
| parent | 6dc3fbb174ef711682331687d39d11df1feb7121 (diff) | |
| download | haminer-0.1.0.tar.xz | |
haminer: send heartbeat indicator if logs is emptyv0.1.0
An administrator may need to monitor if the haminer service is running or
not through kapacitor. With heartbeat, we can tell if haminer is not
running if no data is send along, say, one hour.
Diffstat (limited to 'haminer.go')
| -rw-r--r-- | haminer.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -137,6 +137,11 @@ func (h *Haminer) consume() { } func (h *Haminer) forwards(halogs []*Halog) { + // Send heartbeat indicator, if logs is empty. + if len(halogs) == 0 { + heartbeat.Timestamp = time.Now() + halogs = append(halogs, heartbeat) + } for _, fwder := range h.ff { fwder.Forwards(halogs) } @@ -161,6 +166,7 @@ func (h *Haminer) produce() { halogs = append(halogs, halog) case <-ticker.C: h.forwards(halogs) + halogs = nil } } } |
