From 56edd339e7840621ee991059bd144f69ef23eb36 Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Tue, 30 Jan 2018 13:58:44 -0800 Subject: [PATCH] Exclude master_replid fields from redis input (#3725) (cherry picked from commit c28d0e1b168426c88330aca2ce87c87130c5d07b) --- plugins/inputs/redis/README.md | 1 + plugins/inputs/redis/redis.go | 4 ++++ plugins/inputs/redis/redis_test.go | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/plugins/inputs/redis/README.md b/plugins/inputs/redis/README.md index 263923d4a..cb6380ab8 100644 --- a/plugins/inputs/redis/README.md +++ b/plugins/inputs/redis/README.md @@ -88,6 +88,7 @@ Additionally the plugin also calculates the hit/miss ratio (keyspace\_hitrate) a **Replication** - connected_slaves(int, number) - master_repl_offset(int, number) + - second_repl_offset(int, number) - repl_backlog_active(int, number) - repl_backlog_size(int, bytes) - repl_backlog_first_byte_offset(int, number) diff --git a/plugins/inputs/redis/redis.go b/plugins/inputs/redis/redis.go index 7f6143340..435bede5a 100644 --- a/plugins/inputs/redis/redis.go +++ b/plugins/inputs/redis/redis.go @@ -189,6 +189,10 @@ func gatherInfoOutput( } } + if strings.HasPrefix(name, "master_replid") { + continue + } + if name == "mem_allocator" { continue } diff --git a/plugins/inputs/redis/redis_test.go b/plugins/inputs/redis/redis_test.go index 7d2fd1b51..fd16bbdd9 100644 --- a/plugins/inputs/redis/redis_test.go +++ b/plugins/inputs/redis/redis_test.go @@ -86,6 +86,7 @@ func TestRedis_ParseMetrics(t *testing.T) { "repl_backlog_size": int64(1048576), "repl_backlog_first_byte_offset": int64(0), "repl_backlog_histlen": int64(0), + "second_repl_offset": int64(-1), "used_cpu_sys": float64(0.14), "used_cpu_user": float64(0.05), "used_cpu_sys_children": float64(0.00), @@ -189,7 +190,10 @@ latest_fork_usec:0 # Replication role:master connected_slaves:0 +master_replid:8c4d7b768b26826825ceb20ff4a2c7c54616350b +master_replid2:0000000000000000000000000000000000000000 master_repl_offset:0 +second_repl_offset:-1 repl_backlog_active:0 repl_backlog_size:1048576 repl_backlog_first_byte_offset:0