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 810f2e74e8
commit 868f7abc64
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,
}
fields := map[string]interface{}{
"node_name": n.GetName(), "node_name": n.GetName(),
} }
fields := make(map[string]interface{})
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,
}
nTags["namespace"] = namespace
nFields := map[string]interface{}{
"node_name": n.GetName(), "node_name": n.GetName(),
} }
nTags["namespace"] = namespace
nFields := make(map[string]interface{})
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"))
} }