From f7504fb5eb1d3a740e581d418640133ffd281a2c Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Mon, 19 Oct 2015 18:43:40 -0600 Subject: [PATCH] InfluxDB does not accept uint64, so cast them down to int64 Fixes #290 --- accumulator.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/accumulator.go b/accumulator.go index f7fb7c1e421d0..d1f8adf614e56 100644 --- a/accumulator.go +++ b/accumulator.go @@ -134,6 +134,16 @@ func (bp *BatchPoints) AddFields( bp.Lock() defer bp.Unlock() + // InfluxDB does not support writing uint64 + for k, v := range fields { + switch val := v.(type) { + case uint64: + if val < uint64(9223372036854775808) { + fields[k] = int64(val) + } + } + } + measurement = bp.Prefix + measurement if bp.Config != nil {