Skip to content

Commit

Permalink
Collectd input should use "value" as field name
Browse files Browse the repository at this point in the history
Fixes issue #2412
  • Loading branch information
otoolep committed Apr 30, 2015
1 parent c3e6ea2 commit 69810e1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Bugfixes
- [#2446] (https://github.com/influxdb/influxdb/pull/2446): Correctly count number of queries executed. Thanks @neonstalwart
- [#2452](https://github.com/influxdb/influxdb/issues/2452): Fix panic with shard stats on multiple clusters
- [#2460](https://github.com/influxdb/influxdb/issues/2460): Collectd input should use "value" for fields values. Fixes 2412. Thanks @josh-padnick

## v0.9.0-rc28 [04-27-2015]

Expand Down
2 changes: 1 addition & 1 deletion collectd/collectd.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func Unmarshal(data *gollectd.Packet) []influxdb.Point {
tags := make(map[string]string)
fields := make(map[string]interface{})

fields[name] = data.Values[i].Value
fields["value"] = data.Values[i].Value

if data.Hostname != "" {
tags["host"] = data.Hostname
Expand Down
10 changes: 5 additions & 5 deletions collectd/collectd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func TestUnmarshal_Points(t *testing.T) {
},
},
points: []influxdb.Point{
{Name: "disk_read", Fields: map[string]interface{}{"disk_read": float64(1)}},
{Name: "disk_read", Fields: map[string]interface{}{"value": float64(1)}},
},
},
{
Expand All @@ -230,8 +230,8 @@ func TestUnmarshal_Points(t *testing.T) {
},
},
points: []influxdb.Point{
{Name: "disk_read", Fields: map[string]interface{}{"disk_read": float64(1)}},
{Name: "disk_write", Fields: map[string]interface{}{"disk_write": float64(5)}},
{Name: "disk_read", Fields: map[string]interface{}{"value": float64(1)}},
{Name: "disk_write", Fields: map[string]interface{}{"value": float64(5)}},
},
},
{
Expand All @@ -250,7 +250,7 @@ func TestUnmarshal_Points(t *testing.T) {
{
Name: "disk_read",
Tags: map[string]string{"host": "server01", "instance": "sdk", "type": "disk_octets", "type_instance": "single"},
Fields: map[string]interface{}{"disk_read": float64(1)},
Fields: map[string]interface{}{"value": float64(1)},
},
},
},
Expand All @@ -269,7 +269,7 @@ func TestUnmarshal_Points(t *testing.T) {
t.Errorf("point name mismatch. expected %q, got %q", name, m.Name)
}
// test value
mv := m.Fields[m.Name].(float64)
mv := m.Fields["value"].(float64)
pv := test.packet.Values[i].Value
if mv != pv {
t.Errorf("point value mismatch. expected %v, got %v", pv, mv)
Expand Down

0 comments on commit 69810e1

Please sign in to comment.