move plugin interfaces into separate package
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/plugins"
|
||||
"github.com/influxdata/telegraf/metric"
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ type ValueParser struct {
|
||||
DefaultTags map[string]string
|
||||
}
|
||||
|
||||
func (v *ValueParser) Parse(buf []byte) ([]telegraf.Metric, error) {
|
||||
func (v *ValueParser) Parse(buf []byte) ([]plugins.Metric, error) {
|
||||
vStr := string(bytes.TrimSpace(bytes.Trim(buf, "\x00")))
|
||||
|
||||
// unless it's a string, separate out any fields in the buffer,
|
||||
@@ -25,7 +25,7 @@ func (v *ValueParser) Parse(buf []byte) ([]telegraf.Metric, error) {
|
||||
if v.DataType != "string" {
|
||||
values := strings.Fields(vStr)
|
||||
if len(values) < 1 {
|
||||
return []telegraf.Metric{}, nil
|
||||
return []plugins.Metric{}, nil
|
||||
}
|
||||
vStr = string(values[len(values)-1])
|
||||
}
|
||||
@@ -53,10 +53,10 @@ func (v *ValueParser) Parse(buf []byte) ([]telegraf.Metric, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return []telegraf.Metric{metric}, nil
|
||||
return []plugins.Metric{metric}, nil
|
||||
}
|
||||
|
||||
func (v *ValueParser) ParseLine(line string) (telegraf.Metric, error) {
|
||||
func (v *ValueParser) ParseLine(line string) (plugins.Metric, error) {
|
||||
metrics, err := v.Parse([]byte(line))
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user