Skip to content

Commit

Permalink
Remove metric.Point from metric interface
Browse files Browse the repository at this point in the history
  • Loading branch information
sparrc committed Feb 3, 2017
1 parent b1945c0 commit 694955c
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 36 deletions.
1 change: 0 additions & 1 deletion Godeps
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ github.com/hailocab/go-hostpool e80d13ce29ede4452c43dea11e79b9bc8a15b478
github.com/hashicorp/consul 63d2fc68239b996096a1c55a0d4b400ea4c2583f
github.com/hpcloud/tail 915e5feba042395f5fda4dbe9c0e99aeab3088b3
github.com/influxdata/config 8ec4638a81500c20be24855812bc8498ebe2dc92
github.com/influxdata/influxdb 2fe8ed308439a98a9b01943939b44048ed952c90
github.com/influxdata/toml ad49a5c2936f96b8f5943c3fdba47630ccf45a0d
github.com/influxdata/wlog 7c63b0a71ef8300adc255344d275e10e5c3a71ec
github.com/jackc/pgx c8080fc4a1bfa44bf90383ad0fdce2f68b7d313c
Expand Down
7 changes: 0 additions & 7 deletions metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ package telegraf

import (
"time"

// TODO remove
"github.com/influxdata/influxdb/client/v2"
)

// ValueType is an enumeration of metric types that represent a simple value.
Expand Down Expand Up @@ -62,8 +59,4 @@ type Metric interface {
// aggregator things:
SetAggregate(bool)
IsAggregate() bool

// Point returns a influxdb client.Point object
// TODO remove this function
Point() *client.Point
}
8 changes: 0 additions & 8 deletions metric/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import (
"time"

"github.com/influxdata/telegraf"

// TODO remove
"github.com/influxdata/influxdb/client/v2"
)

const MaxInt = int(^uint(0) >> 1)
Expand Down Expand Up @@ -137,11 +134,6 @@ type metric struct {
nsec int64
}

func (m *metric) Point() *client.Point {
c, _ := client.NewPoint(m.Name(), m.Tags(), m.Fields(), m.Time())
return c
}

func (m *metric) String() string {
return string(m.name) + string(m.tags) + " " + string(m.fields) + " " + string(m.t) + "\n"
}
Expand Down
20 changes: 0 additions & 20 deletions metric/metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,26 +595,6 @@ func TestNewMetricAggregate(t *testing.T) {
assert.True(t, m.IsAggregate())
}

func TestNewMetricPoint(t *testing.T) {
now := time.Now()

tags := map[string]string{
"host": "localhost",
}
fields := map[string]interface{}{
"usage_idle": float64(99),
}
m, err := New("cpu", tags, fields, now)
assert.NoError(t, err)

p := m.Point()
pfields, _ := p.Fields()

assert.Equal(t, fields, m.Fields())
assert.Equal(t, fields, pfields)
assert.Equal(t, "cpu", p.Name())
}

func TestNewMetricString(t *testing.T) {
now := time.Now()

Expand Down

0 comments on commit 694955c

Please sign in to comment.