move plugin interfaces into separate package
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/plugins"
|
||||
)
|
||||
|
||||
const DEFAULT_TEMPLATE = "host.tags.measurement.field"
|
||||
@@ -20,7 +20,7 @@ type GraphiteSerializer struct {
|
||||
Template string
|
||||
}
|
||||
|
||||
func (s *GraphiteSerializer) Serialize(metric telegraf.Metric) ([]byte, error) {
|
||||
func (s *GraphiteSerializer) Serialize(metric plugins.Metric) ([]byte, error) {
|
||||
out := []byte{}
|
||||
|
||||
// Convert UnixNano to Unix timestamps
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package influx
|
||||
|
||||
import (
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/plugins"
|
||||
)
|
||||
|
||||
type InfluxSerializer struct {
|
||||
}
|
||||
|
||||
func (s *InfluxSerializer) Serialize(m telegraf.Metric) ([]byte, error) {
|
||||
func (s *InfluxSerializer) Serialize(m plugins.Metric) ([]byte, error) {
|
||||
return m.Serialize(), nil
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ package json
|
||||
import (
|
||||
ejson "encoding/json"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/plugins"
|
||||
)
|
||||
|
||||
type JsonSerializer struct {
|
||||
}
|
||||
|
||||
func (s *JsonSerializer) Serialize(metric telegraf.Metric) ([]byte, error) {
|
||||
func (s *JsonSerializer) Serialize(metric plugins.Metric) ([]byte, error) {
|
||||
m := make(map[string]interface{})
|
||||
m["tags"] = metric.Tags()
|
||||
m["fields"] = metric.Fields()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package serializers
|
||||
|
||||
import (
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/plugins"
|
||||
|
||||
"github.com/influxdata/telegraf/plugins/serializers/graphite"
|
||||
"github.com/influxdata/telegraf/plugins/serializers/influx"
|
||||
@@ -21,7 +21,7 @@ type Serializer interface {
|
||||
// Serialize takes a single telegraf metric and turns it into a byte buffer.
|
||||
// separate metrics should be separated by a newline, and there should be
|
||||
// a newline at the end of the buffer.
|
||||
Serialize(metric telegraf.Metric) ([]byte, error)
|
||||
Serialize(metric plugins.Metric) ([]byte, error)
|
||||
}
|
||||
|
||||
// Config is a struct that covers the data types needed for all serializer types,
|
||||
|
||||
Reference in New Issue
Block a user