Fix format of StdoutSink

This commit is contained in:
Thomas Roehl 2021-03-26 17:08:00 +01:00
parent 913c3719a9
commit fe87b2c7cb

View File

@ -2,9 +2,9 @@ package sinks
import (
"fmt"
"time"
"strings"
"math"
"strings"
"time"
)
type StdoutSink struct {
@ -23,10 +23,10 @@ func (s *StdoutSink) Init(host string, port string, user string, password string
func (s *StdoutSink) Write(measurement string, tags map[string]string, fields map[string]interface{}, t time.Time) error {
var tagsstr []string
var fieldstr []string
for k,v := range tags {
for k, v := range tags {
tagsstr = append(tagsstr, fmt.Sprintf("%s=%s", k, v))
}
for k,v := range fields {
for k, v := range fields {
if !math.IsNaN(v.(float64)) {
fieldstr = append(fieldstr, fmt.Sprintf("%s=%v", k, v.(float64)))
}