Removed leaked "database" tag on redis metrics (#1316)
This commit is contained in:
parent
8baeb42c0f
commit
bfa0c60a53
|
@ -47,6 +47,7 @@ time before a new metric is included by the plugin.
|
||||||
- [#1268](https://github.com/influxdata/telegraf/pull/1268): Fix potential influxdb input type assertion panic.
|
- [#1268](https://github.com/influxdata/telegraf/pull/1268): Fix potential influxdb input type assertion panic.
|
||||||
- [#1283](https://github.com/influxdata/telegraf/pull/1283): Still send processes metrics if a process exited during metric collection.
|
- [#1283](https://github.com/influxdata/telegraf/pull/1283): Still send processes metrics if a process exited during metric collection.
|
||||||
- [#1297](https://github.com/influxdata/telegraf/issues/1297): disk plugin panic when usage grab fails.
|
- [#1297](https://github.com/influxdata/telegraf/issues/1297): disk plugin panic when usage grab fails.
|
||||||
|
- [#1316](https://github.com/influxdata/telegraf/pull/1316): Removed leaked "database" tag on redis metrics. Thanks @PierreF!
|
||||||
|
|
||||||
## v0.13.1 [2016-05-24]
|
## v0.13.1 [2016-05-24]
|
||||||
|
|
||||||
|
|
|
@ -241,10 +241,14 @@ func gatherKeyspaceLine(
|
||||||
name string,
|
name string,
|
||||||
line string,
|
line string,
|
||||||
acc telegraf.Accumulator,
|
acc telegraf.Accumulator,
|
||||||
tags map[string]string,
|
global_tags map[string]string,
|
||||||
) {
|
) {
|
||||||
if strings.Contains(line, "keys=") {
|
if strings.Contains(line, "keys=") {
|
||||||
fields := make(map[string]interface{})
|
fields := make(map[string]interface{})
|
||||||
|
tags := make(map[string]string)
|
||||||
|
for k, v := range global_tags {
|
||||||
|
tags[k] = v
|
||||||
|
}
|
||||||
tags["database"] = name
|
tags["database"] = name
|
||||||
dbparts := strings.Split(line, ",")
|
dbparts := strings.Split(line, ",")
|
||||||
for _, dbp := range dbparts {
|
for _, dbp := range dbparts {
|
||||||
|
|
|
@ -35,6 +35,7 @@ func TestRedis_ParseMetrics(t *testing.T) {
|
||||||
err := gatherInfoOutput(rdr, &acc, tags)
|
err := gatherInfoOutput(rdr, &acc, tags)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
tags = map[string]string{"host": "redis.net", "role": "master"}
|
||||||
fields := map[string]interface{}{
|
fields := map[string]interface{}{
|
||||||
"uptime": uint64(238),
|
"uptime": uint64(238),
|
||||||
"clients": uint64(1),
|
"clients": uint64(1),
|
||||||
|
@ -70,13 +71,14 @@ func TestRedis_ParseMetrics(t *testing.T) {
|
||||||
"used_cpu_user_children": float64(0.00),
|
"used_cpu_user_children": float64(0.00),
|
||||||
"keyspace_hitrate": float64(0.50),
|
"keyspace_hitrate": float64(0.50),
|
||||||
}
|
}
|
||||||
|
keyspaceTags := map[string]string{"host": "redis.net", "role": "master", "database": "db0"}
|
||||||
keyspaceFields := map[string]interface{}{
|
keyspaceFields := map[string]interface{}{
|
||||||
"avg_ttl": uint64(0),
|
"avg_ttl": uint64(0),
|
||||||
"expires": uint64(0),
|
"expires": uint64(0),
|
||||||
"keys": uint64(2),
|
"keys": uint64(2),
|
||||||
}
|
}
|
||||||
acc.AssertContainsTaggedFields(t, "redis", fields, tags)
|
acc.AssertContainsTaggedFields(t, "redis", fields, tags)
|
||||||
acc.AssertContainsTaggedFields(t, "redis_keyspace", keyspaceFields, tags)
|
acc.AssertContainsTaggedFields(t, "redis_keyspace", keyspaceFields, keyspaceTags)
|
||||||
}
|
}
|
||||||
|
|
||||||
const testOutput = `# Server
|
const testOutput = `# Server
|
||||||
|
|
Loading…
Reference in New Issue