Redis input enhancement (#1387)

master_last_io_seconds_ago added
role tag renamed to replication_role
This commit is contained in:
Andrei Burd 2016-07-14 20:28:36 +01:00 committed by Cameron Sparr
parent bfdd665435
commit 97d92bba67
4 changed files with 8 additions and 4 deletions

View File

@ -33,6 +33,7 @@ should now look like:
- [#1402](https://github.com/influxdata/telegraf/pull/1402): docker-machine/boot2docker no longer required for unit tests. - [#1402](https://github.com/influxdata/telegraf/pull/1402): docker-machine/boot2docker no longer required for unit tests.
- [#1350](https://github.com/influxdata/telegraf/pull/1350): cgroup input plugin. - [#1350](https://github.com/influxdata/telegraf/pull/1350): cgroup input plugin.
- [#1369](https://github.com/influxdata/telegraf/pull/1369): Add input plugin for consuming metrics from NSQD. - [#1369](https://github.com/influxdata/telegraf/pull/1369): Add input plugin for consuming metrics from NSQD.
- [#1387](https://github.com/influxdata/telegraf/pull/1387): **Breaking Change** - Redis `role` tag renamed to `replication_role` to avoid global_tags override
### Bugfixes ### Bugfixes

View File

@ -43,6 +43,7 @@
- latest_fork_usec - latest_fork_usec
- connected_slaves - connected_slaves
- master_repl_offset - master_repl_offset
- master_last_io_seconds_ago
- repl_backlog_active - repl_backlog_active
- repl_backlog_size - repl_backlog_size
- repl_backlog_histlen - repl_backlog_histlen
@ -57,6 +58,7 @@
- All measurements have the following tags: - All measurements have the following tags:
- port - port
- server - server
- replication role
### Example Output: ### Example Output:

View File

@ -66,6 +66,7 @@ var Tracking = map[string]string{
"latest_fork_usec": "latest_fork_usec", "latest_fork_usec": "latest_fork_usec",
"connected_slaves": "connected_slaves", "connected_slaves": "connected_slaves",
"master_repl_offset": "master_repl_offset", "master_repl_offset": "master_repl_offset",
"master_last_io_seconds_ago": "master_last_io_seconds_ago",
"repl_backlog_active": "repl_backlog_active", "repl_backlog_active": "repl_backlog_active",
"repl_backlog_size": "repl_backlog_size", "repl_backlog_size": "repl_backlog_size",
"repl_backlog_histlen": "repl_backlog_histlen", "repl_backlog_histlen": "repl_backlog_histlen",
@ -74,7 +75,7 @@ var Tracking = map[string]string{
"used_cpu_user": "used_cpu_user", "used_cpu_user": "used_cpu_user",
"used_cpu_sys_children": "used_cpu_sys_children", "used_cpu_sys_children": "used_cpu_sys_children",
"used_cpu_user_children": "used_cpu_user_children", "used_cpu_user_children": "used_cpu_user_children",
"role": "role", "role": "replication_role",
} }
var ErrProtocolError = errors.New("redis protocol error") var ErrProtocolError = errors.New("redis protocol error")
@ -208,7 +209,7 @@ func gatherInfoOutput(
} }
if name == "role" { if name == "role" {
tags["role"] = val tags["replication_role"] = val
continue continue
} }

View File

@ -35,7 +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"} tags = map[string]string{"host": "redis.net", "replication_role": "master"}
fields := map[string]interface{}{ fields := map[string]interface{}{
"uptime": uint64(238), "uptime": uint64(238),
"clients": uint64(1), "clients": uint64(1),
@ -71,7 +71,7 @@ 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"} keyspaceTags := map[string]string{"host": "redis.net", "replication_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),