Implement telegraf's own full metric type
main reasons behind this: - make adding/removing tags cheap - make adding/removing fields cheap - make parsing cheaper - make parse -> decorate -> write out bytes metric flow much faster Refactor serializer to use byte buffer
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/metric"
|
||||
)
|
||||
|
||||
type ValueParser struct {
|
||||
@@ -46,7 +47,7 @@ func (v *ValueParser) Parse(buf []byte) ([]telegraf.Metric, error) {
|
||||
}
|
||||
|
||||
fields := map[string]interface{}{"value": value}
|
||||
metric, err := telegraf.NewMetric(v.MetricName, v.DefaultTags,
|
||||
metric, err := metric.New(v.MetricName, v.DefaultTags,
|
||||
fields, time.Now().UTC())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user