jolokia: add 'server_' prefix to tags
it avoid overwriting the telegraf-wide host tag
This commit is contained in:
parent
5e9980f263
commit
cd3202f402
|
@ -54,4 +54,4 @@ are collected for each server configured.
|
||||||
See: https://jolokia.org/
|
See: https://jolokia.org/
|
||||||
|
|
||||||
# Measurements:
|
# Measurements:
|
||||||
Jolokia plugin produces one measure for each metric configured, adding Server's `name`, `host` and `port` as tags.
|
Jolokia plugin produces one measure for each metric configured, adding Server's `server_name`, `server_host` and `server_port` as tags.
|
||||||
|
|
|
@ -222,9 +222,9 @@ func (j *Jolokia) Gather(acc telegraf.Accumulator) error {
|
||||||
tags := make(map[string]string)
|
tags := make(map[string]string)
|
||||||
|
|
||||||
for _, server := range servers {
|
for _, server := range servers {
|
||||||
tags["server"] = server.Name
|
tags["server_name"] = server.Name
|
||||||
tags["port"] = server.Port
|
tags["server_port"] = server.Port
|
||||||
tags["host"] = server.Host
|
tags["server_host"] = server.Host
|
||||||
fields := make(map[string]interface{})
|
fields := make(map[string]interface{})
|
||||||
|
|
||||||
for _, metric := range metrics {
|
for _, metric := range metrics {
|
||||||
|
|
|
@ -96,9 +96,9 @@ func TestHttpJsonMultiValue(t *testing.T) {
|
||||||
"heap_memory_usage_used": 203288528.0,
|
"heap_memory_usage_used": 203288528.0,
|
||||||
}
|
}
|
||||||
tags := map[string]string{
|
tags := map[string]string{
|
||||||
"host": "127.0.0.1",
|
"server_host": "127.0.0.1",
|
||||||
"port": "8080",
|
"server_port": "8080",
|
||||||
"server": "as1",
|
"server_name": "as1",
|
||||||
}
|
}
|
||||||
acc.AssertContainsTaggedFields(t, "jolokia", fields, tags)
|
acc.AssertContainsTaggedFields(t, "jolokia", fields, tags)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue