Remove metric.Point from metric interface
This commit is contained in:
parent
aeffacbe4a
commit
f6e1409c9a
1
Godeps
1
Godeps
|
@ -26,7 +26,6 @@ github.com/hailocab/go-hostpool e80d13ce29ede4452c43dea11e79b9bc8a15b478
|
||||||
github.com/hashicorp/consul 63d2fc68239b996096a1c55a0d4b400ea4c2583f
|
github.com/hashicorp/consul 63d2fc68239b996096a1c55a0d4b400ea4c2583f
|
||||||
github.com/hpcloud/tail 915e5feba042395f5fda4dbe9c0e99aeab3088b3
|
github.com/hpcloud/tail 915e5feba042395f5fda4dbe9c0e99aeab3088b3
|
||||||
github.com/influxdata/config 8ec4638a81500c20be24855812bc8498ebe2dc92
|
github.com/influxdata/config 8ec4638a81500c20be24855812bc8498ebe2dc92
|
||||||
github.com/influxdata/influxdb 2fe8ed308439a98a9b01943939b44048ed952c90
|
|
||||||
github.com/influxdata/toml ad49a5c2936f96b8f5943c3fdba47630ccf45a0d
|
github.com/influxdata/toml ad49a5c2936f96b8f5943c3fdba47630ccf45a0d
|
||||||
github.com/influxdata/wlog 7c63b0a71ef8300adc255344d275e10e5c3a71ec
|
github.com/influxdata/wlog 7c63b0a71ef8300adc255344d275e10e5c3a71ec
|
||||||
github.com/jackc/pgx c8080fc4a1bfa44bf90383ad0fdce2f68b7d313c
|
github.com/jackc/pgx c8080fc4a1bfa44bf90383ad0fdce2f68b7d313c
|
||||||
|
|
|
@ -2,9 +2,6 @@ package telegraf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
// TODO remove
|
|
||||||
"github.com/influxdata/influxdb/client/v2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ValueType is an enumeration of metric types that represent a simple value.
|
// ValueType is an enumeration of metric types that represent a simple value.
|
||||||
|
@ -62,8 +59,4 @@ type Metric interface {
|
||||||
// aggregator things:
|
// aggregator things:
|
||||||
SetAggregate(bool)
|
SetAggregate(bool)
|
||||||
IsAggregate() bool
|
IsAggregate() bool
|
||||||
|
|
||||||
// Point returns a influxdb client.Point object
|
|
||||||
// TODO remove this function
|
|
||||||
Point() *client.Point
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/influxdata/telegraf"
|
"github.com/influxdata/telegraf"
|
||||||
|
|
||||||
// TODO remove
|
|
||||||
"github.com/influxdata/influxdb/client/v2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const MaxInt = int(^uint(0) >> 1)
|
const MaxInt = int(^uint(0) >> 1)
|
||||||
|
@ -137,11 +134,6 @@ type metric struct {
|
||||||
nsec int64
|
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 {
|
func (m *metric) String() string {
|
||||||
return string(m.name) + string(m.tags) + " " + string(m.fields) + " " + string(m.t) + "\n"
|
return string(m.name) + string(m.tags) + " " + string(m.fields) + " " + string(m.t) + "\n"
|
||||||
}
|
}
|
||||||
|
|
|
@ -595,26 +595,6 @@ func TestNewMetricAggregate(t *testing.T) {
|
||||||
assert.True(t, m.IsAggregate())
|
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) {
|
func TestNewMetricString(t *testing.T) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue