Throughout telegraf, use telegraf.Metric rather than client.Point

closes #599
This commit is contained in:
Cameron Sparr
2016-01-27 16:15:14 -07:00
parent 9c0d14bb60
commit c549ab907a
52 changed files with 391 additions and 437 deletions

View File

@@ -2,9 +2,8 @@ package nsq
import (
"fmt"
"github.com/influxdata/influxdb/client/v2"
"github.com/influxdata/telegraf/plugins/outputs"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/outputs"
"github.com/nsqio/go-nsq"
)
@@ -46,14 +45,12 @@ func (n *NSQ) Description() string {
return "Send telegraf measurements to NSQD"
}
func (n *NSQ) Write(points []*client.Point) error {
if len(points) == 0 {
func (n *NSQ) Write(metrics []telegraf.Metric) error {
if len(metrics) == 0 {
return nil
}
for _, p := range points {
// Combine tags from Point and BatchPoints and grab the resulting
// line-protocol output string to write to NSQ
for _, p := range metrics {
value := p.String()
err := n.producer.Publish(n.Topic, []byte(value))

View File

@@ -23,6 +23,6 @@ func TestConnectAndWrite(t *testing.T) {
require.NoError(t, err)
// Verify that we can successfully write data to the NSQ daemon
err = n.Write(testutil.MockBatchPoints().Points())
err = n.Write(testutil.MockMetrics())
require.NoError(t, err)
}