convert decimal64 to float64
@@ -6,6 +6,7 @@ import (
"encoding/json"
"io/ioutil"
"log"
+ "math"
"time"
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
@@ -260,6 +261,12 @@ START:
i.logger.Printf("worker-%d terminating...", idx)
return
case ev := <-i.eventChan:
+ for n, v := range ev.Values {
+ switch v := v.(type) {
+ case *gnmi.Decimal64:
+ ev.Values[n] = float64(v.Digits) / math.Pow10(int(v.Precision))
+ }
+ }
writer.WritePoint(influxdb2.NewPoint(ev.Name, ev.Tags, ev.Values, time.Unix(0, ev.Timestamp)))
case <-i.reset:
firstStart = false
