Change node_name to be a tag in aerospike input (#2918)
This commit is contained in:
parent
810f2e74e8
commit
868f7abc64
File diff suppressed because one or more lines are too long
|
@ -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
|
||||||
|
|
|
@ -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"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue