Add Flush method to sink interface

This commit is contained in:
Lou Knauer
2021-10-12 13:43:58 +02:00
parent dc4b8d13c2
commit cdc1811576
5 changed files with 21 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import (
"crypto/tls"
"errors"
"fmt"
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
influxdb2Api "github.com/influxdata/influxdb-client-go/v2/api"
lp "github.com/influxdata/line-protocol"
@@ -57,8 +58,8 @@ func (s *InfluxSink) Init(config SinkConfig) error {
}
func (s *InfluxSink) Write(point lp.MutableMetric) error {
var tags map[string]string
var fields map[string]interface{}
tags := map[string]string{}
fields := map[string]interface{}{}
for _, t := range point.TagList() {
tags[t.Key] = t.Value
}
@@ -70,6 +71,10 @@ func (s *InfluxSink) Write(point lp.MutableMetric) error {
return err
}
func (s *InfluxSink) Flush() error {
return nil
}
func (s *InfluxSink) Close() {
log.Print("Closing InfluxDB connection")
s.client.Close()