Change node_name to be a tag in aerospike input (#2918)

This commit is contained in:
Daniel Nelson 2017-06-13 17:09:38 -07:00 committed by GitHub
parent b0efc22140
commit 619b5d4c14
3 changed files with 11 additions and 11 deletions

File diff suppressed because one or more lines are too long

View File

@ -73,10 +73,9 @@ func (a *Aerospike) gatherServer(hostport string, acc telegraf.Accumulator) erro
for _, n := range nodes { for _, n := range nodes {
tags := map[string]string{ tags := map[string]string{
"aerospike_host": hostport, "aerospike_host": hostport,
"node_name": n.GetName(),
} }
fields := map[string]interface{}{ fields := make(map[string]interface{})
"node_name": n.GetName(),
}
stats, err := as.RequestNodeStats(n) stats, err := as.RequestNodeStats(n)
if err != nil { if err != nil {
return err return err
@ -100,11 +99,10 @@ func (a *Aerospike) gatherServer(hostport string, acc telegraf.Accumulator) erro
for _, namespace := range namespaces { for _, namespace := range namespaces {
nTags := map[string]string{ nTags := map[string]string{
"aerospike_host": hostport, "aerospike_host": hostport,
"node_name": n.GetName(),
} }
nTags["namespace"] = namespace nTags["namespace"] = namespace
nFields := map[string]interface{}{ nFields := make(map[string]interface{})
"node_name": n.GetName(),
}
info, err := as.RequestNodeInfo(n, "namespace/"+namespace) info, err := as.RequestNodeInfo(n, "namespace/"+namespace)
if err != nil { if err != nil {
continue continue

View File

@ -23,7 +23,9 @@ func TestAerospikeStatistics(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
assert.True(t, acc.HasMeasurement("aerospike_node")) assert.True(t, acc.HasMeasurement("aerospike_node"))
assert.True(t, acc.HasTag("aerospike_node", "node_name"))
assert.True(t, acc.HasMeasurement("aerospike_namespace")) assert.True(t, acc.HasMeasurement("aerospike_namespace"))
assert.True(t, acc.HasTag("aerospike_namespace", "node_name"))
assert.True(t, acc.HasInt64Field("aerospike_node", "batch_error")) assert.True(t, acc.HasInt64Field("aerospike_node", "batch_error"))
} }