Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fields renamed on redis 5.0 #8167

Merged
merged 5 commits into from
Sep 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ https://github.com/elastic/beats/compare/v6.4.0...master[Check the HEAD diff]
- Add fields for mermory fragmentation, memory allocator stats, copy on write, master-slave status, and active defragmentation to `info` metricset of Redis module. {pull}7695[7695]
- Add experimental socket summary metricset to system module {pull}6782[6782]
- Increase ignore_above for system.process.cmdline to 2048. {pull}8101[8100]
- Add support to renamed fields planned for redis 5.0. {pull}8167[8167]

*Packetbeat*

Expand All @@ -136,6 +137,7 @@ https://github.com/elastic/beats/compare/v6.4.0...master[Check the HEAD diff]

*Metricbeat*
- Redis `info` `replication.master_offset` has been deprecated in favor of `replication.master.offset`.{pull}7695[7695]
- Redis `info` clients fields `longest_output_list` and `biggest_input_buf` have been renamed to `max_output_buffer` and `max_input_buffer` based on the names they will have in Redis 5.0, both fields will coexist during a time with the same value {pull}8167[8167].

- Move common kafka fields (broker, topic and partition.id) to the module level {pull}7767[7767].

Expand Down
12 changes: 12 additions & 0 deletions metricbeat/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,18 @@ services:
redis:
build: ./module/redis/_meta

redis_4:
build:
context: ./module/redis/_meta
args:
REDIS_VERSION: 4.0.11

redis_5:
build:
context: ./module/redis/_meta
args:
REDIS_VERSION: 5.0-rc4

traefik:
build: ./module/traefik/_meta

Expand Down
28 changes: 27 additions & 1 deletion metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16093,6 +16093,19 @@ Number of client connections (excluding connections from slaves).
*`redis.info.clients.longest_output_list`*::
+
--

deprecated[6.5.0]

type: long

Longest output list among current client connections (replaced by max_output_buffer).


--

*`redis.info.clients.max_output_buffer`*::
+
--
type: long

Longest output list among current client connections.
Expand All @@ -16103,9 +16116,22 @@ Longest output list among current client connections.
*`redis.info.clients.biggest_input_buf`*::
+
--

deprecated[6.5.0]

type: long

Biggest input buffer among current client connections (replaced by max_input_buffer).


--

*`redis.info.clients.max_input_buffer`*::
+
--
type: long

Biggest input buffer among current client connections.
Biggest input buffer among current client connections (on redis 5.0).


--
Expand Down
4 changes: 2 additions & 2 deletions metricbeat/docs/modules/redis.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ The Redis module has these additional config options:
[float]
=== Compatibility

The Redis metricsets were tested with Redis 3.2.4 and are expected to work with all version
>= 3.0.
The Redis metricsets were tested with Redis 3.2.12, 4.0.11 and 5.0-rc4, and are expected
to work with all versions >= 3.0.


[float]
Expand Down
3 changes: 2 additions & 1 deletion metricbeat/module/redis/_meta/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
FROM redis:3.2.4-alpine
ARG REDIS_VERSION=3.2.12
FROM redis:${REDIS_VERSION}-alpine
HEALTHCHECK --interval=1s --retries=90 CMD nc -z localhost 6379
4 changes: 2 additions & 2 deletions metricbeat/module/redis/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ The Redis module has these additional config options:
[float]
=== Compatibility

The Redis metricsets were tested with Redis 3.2.4 and are expected to work with all version
>= 3.0.
The Redis metricsets were tested with Redis 3.2.12, 4.0.11 and 5.0-rc4, and are expected
to work with all versions >= 3.0.
2 changes: 1 addition & 1 deletion metricbeat/module/redis/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion metricbeat/module/redis/info/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"biggest_input_buf": 0,
"blocked": 0,
"connected": 1,
"longest_output_list": 0
"longest_output_list": 0,
"max_input_buffer": 0,
"max_output_buffer": 0
},
"cluster": {
"enabled": false
Expand Down
12 changes: 11 additions & 1 deletion metricbeat/module/redis/info/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,23 @@
description: >
Number of client connections (excluding connections from slaves).
- name: longest_output_list
type: long
deprecated: "6.5.0"
description: >
Longest output list among current client connections (replaced by max_output_buffer).
- name: max_output_buffer
type: long
description: >
Longest output list among current client connections.
- name: biggest_input_buf
type: long
deprecated: "6.5.0"
description: >
Biggest input buffer among current client connections (replaced by max_input_buffer).
- name: max_input_buffer
type: long
description: >
Biggest input buffer among current client connections.
Biggest input buffer among current client connections (on redis 5.0).
- name: blocked
type: long
description: >
Expand Down
2 changes: 2 additions & 0 deletions metricbeat/module/redis/info/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ var (
"connected": c.Int("connected_clients"),
"longest_output_list": c.Int("client_longest_output_list"),
"biggest_input_buf": c.Int("client_biggest_input_buf"),
"max_output_buffer": c.Int("client_recent_max_output_buffer"),
"max_input_buffer": c.Int("client_recent_max_input_buffer"),
"blocked": c.Int("blocked_clients"),
},
"cluster": s.Object{
Expand Down
15 changes: 15 additions & 0 deletions metricbeat/module/redis/info/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,21 @@ func (m *MetricSet) Fetch() (common.MapStr, error) {
return nil, err
}

// In 5.0 some fields are renamed, maintain both names, old ones will be deprecated
renamings := []struct {
old, new string
}{
{"client_longest_output_list", "client_recent_max_output_buffer"},
{"client_biggest_input_buf", "client_recent_max_input_buffer"},
}
for _, r := range renamings {
if v, ok := info[r.new]; ok {
info[r.old] = v
} else {
info[r.new] = info[r.old]
}
}

slowLogLength, err := redis.FetchSlowLogLength(m.pool.Get())
if err != nil {
return nil, err
Expand Down
18 changes: 15 additions & 3 deletions metricbeat/tests/system/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"used.user_children"]

CLIENTS_FIELDS = ["blocked", "biggest_input_buf",
"longest_output_list", "connected"]
"longest_output_list", "connected",
"max_input_buffer", "max_output_buffer"]


class Test(metricbeat.BaseTest):
Expand Down Expand Up @@ -58,7 +59,10 @@ def test_keyspace(self):
"""

# At least one event must be inserted so db stats exist
r = redis.StrictRedis(host=os.getenv('REDIS_HOST', 'localhost'), port=os.getenv('REDIS_PORT', '6379'), db=0)
r = redis.StrictRedis(
host=self.compose_hosts()[0],
port=os.getenv('REDIS_PORT', '6379'),
db=0)
r.set('foo', 'bar')

self.render_config_template(modules=[{
Expand Down Expand Up @@ -116,5 +120,13 @@ def test_module_processors(self):
self.assertItemsEqual(self.de_dot(CPU_FIELDS), redis_info["cpu"].keys())

def get_hosts(self):
return [os.getenv('REDIS_HOST', 'localhost') + ':' +
return [self.compose_hosts()[0] + ':' +
os.getenv('REDIS_PORT', '6379')]


class TestRedis4(Test):
COMPOSE_SERVICES = ['redis_4']


class TestRedis5(Test):
COMPOSE_SERVICES = ['redis_5']