Skip to content

Commit 54a59d5

Browse files
italicninjatruthbk
authored andcommitted
Redis updates - Allow command_stats (#327)
* Updating redis.pp to include new command_stats * Add command_stats to template * Updating redis spec
1 parent 40628f6 commit 54a59d5

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

manifests/integrations/redis.pp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
# Optional array of tags
1818
# $keys
1919
# Optional array of keys to check length
20+
# $command_stats
21+
# Collect INFO COMMANDSTATS output as metrics
2022
#
2123
# Sample Usage:
2224
#
@@ -34,12 +36,15 @@
3436
$tags = [],
3537
$keys = [],
3638
$warn_on_missing_keys = true,
39+
$command_stats = false,
40+
3741
) inherits datadog_agent::params {
3842
include datadog_agent
3943

4044
validate_array($tags)
4145
validate_array($keys)
4246
validate_bool($warn_on_missing_keys)
47+
validate_bool($command_stats)
4348

4449
if $ports == undef {
4550
$_ports = [ $port ]

spec/classes/datadog_agent_integrations_redis_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
it { should contain_file(conf_file).without_content(%r{tags:}) }
2929
it { should contain_file(conf_file).without_content(%r{\bkeys:}) }
3030
it { should contain_file(conf_file).with_content(%r{warn_on_missing_keys: true}) }
31+
it { should contain_file(conf_file).with_content(%r{command_stats: false}) }
3132
end
3233

3334
context 'with parameters set' do
@@ -39,6 +40,7 @@
3940
tags: %w{foo bar},
4041
keys: %w{baz bat},
4142
warn_on_missing_keys: false,
43+
command_stats: true,
4244
}}
4345
it { should contain_file(conf_file).with_content(%r{host: redis1}) }
4446
it { should contain_file(conf_file).with_content(%r{^[^#]*password: hunter2}) }
@@ -47,6 +49,7 @@
4749
it { should contain_file(conf_file).with_content(%r{tags:.*\s+- foo\s+- bar}) }
4850
it { should contain_file(conf_file).with_content(%r{keys:.*\s+- baz\s+- bat}) }
4951
it { should contain_file(conf_file).with_content(%r{warn_on_missing_keys: false}) }
52+
it { should contain_file(conf_file).with_content(%r{command_stats: true}) }
5053
end
5154

5255
end

templates/agent-conf.d/redisdb.yaml.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ instances:
99
- host: <%= @host %>
1010
port: <%= port %>
1111
warn_on_missing_keys: <%= @warn_on_missing_keys %>
12+
command_stats: <%= @command_stats %>
1213
<% if @password.empty? %># <%end %>password: <%= @password %>
1314
# unix_socket_path: /var/run/redis/redis.sock # optional, can be used in lieu of host/port
1415
<% if @slowlog_max_len.empty? %># <%end %>slowlog-max-len: <%= @slowlog_max_len %>

0 commit comments

Comments
 (0)