Skip to content

Commit 8a00f1e

Browse files
Charles Fergusonmx-psi
andauthored
Adds support for collecting elasticsearch index_stats (DataDog#666)
* Adds support for collecting elasticsearch index_stats Datadog integration now supports collecting index_stats. This PR adds support to include those stats. * Update spec/classes/datadog_agent_integrations_elasticsearch_spec.rb Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com> Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
1 parent 0aa6f22 commit 8a00f1e

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

manifests/integrations/elasticsearch.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#
2626
class datadog_agent::integrations::elasticsearch(
2727
Boolean $cluster_stats = false,
28+
Boolean $index_stats = false,
2829
Optional[String] $password = undef,
2930
Boolean$pending_task_stats = true,
3031
Boolean $pshard_stats = false,
@@ -47,6 +48,7 @@
4748
if !$instances and $url {
4849
$_instances = [{
4950
'cluster_stats' => $cluster_stats,
51+
'index_stats' => $index_stats,
5052
'password' => $password,
5153
'pending_task_stats' => $pending_task_stats,
5254
'pshard_stats' => $pshard_stats,

spec/classes/datadog_agent_integrations_elasticsearch_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
context 'with default parameters' do
2727
it { is_expected.to contain_file(conf_file).with_content(%r{ - url: http://localhost:9200}) }
2828
it { is_expected.to contain_file(conf_file).with_content(%r{ cluster_stats: false}) }
29+
it { is_expected.to contain_file(conf_file).with_content(%r{ index_stats: false}) }
2930
it { is_expected.to contain_file(conf_file).with_content(%r{ pending_task_stats: true}) }
3031
it { is_expected.to contain_file(conf_file).with_content(%r{ pshard_stats: false}) }
3132
it { is_expected.not_to contain_file(conf_file).with_content(%r{ username}) }
@@ -66,6 +67,7 @@
6667
instances: [
6768
{
6869
'cluster_stats' => true,
70+
'index_stats' => false,
6971
'password' => 'password',
7072
'pending_task_stats' => false,
7173
'pshard_stats' => true,
@@ -78,6 +80,7 @@
7880
},
7981
{
8082
'cluster_stats' => false,
83+
'index_stats' => true,
8184
'password' => 'password_2',
8285
'pending_task_stats' => true,
8386
'pshard_stats' => false,
@@ -93,6 +96,7 @@
9396
it { is_expected.to contain_file(conf_file).with_content(%r{instances:}) }
9497
it { is_expected.to contain_file(conf_file).with_content(%r{ - url: https://foo:4242}) }
9598
it { is_expected.to contain_file(conf_file).with_content(%r{ cluster_stats: true}) }
99+
it { is_expected.to contain_file(conf_file).with_content(%r{ index_stats: false}) }
96100
it { is_expected.to contain_file(conf_file).with_content(%r{ pending_task_stats: false}) }
97101
it { is_expected.to contain_file(conf_file).with_content(%r{ username: username}) }
98102
it { is_expected.to contain_file(conf_file).with_content(%r{ password: password}) }
@@ -103,6 +107,7 @@
103107
it { is_expected.to contain_file(conf_file).with_content(%r{ tags:\n - tag1:key1}) }
104108
it { is_expected.to contain_file(conf_file).with_content(%r{ - url: https://bar:2424}) }
105109
it { is_expected.to contain_file(conf_file).with_content(%r{ cluster_stats: false}) }
110+
it { is_expected.to contain_file(conf_file).with_content(%r{ index_stats: true}) }
106111
it { is_expected.to contain_file(conf_file).with_content(%r{ pending_task_stats: true}) }
107112
it { is_expected.to contain_file(conf_file).with_content(%r{ username: username_2}) }
108113
it { is_expected.to contain_file(conf_file).with_content(%r{ password: password_2}) }

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ instances:
1212
password: <%= instance['password'] %>
1313
<%- end -%>
1414
cluster_stats: <%= instance['cluster_stats'] %>
15+
index_stats: <%= instance['index_stats'] %>
1516
pshard_stats: <%= instance['pshard_stats'] %>
1617
pending_task_stats: <%= instance['pending_task_stats'] %>
1718
<%- if instance['url'].match(/^https/) -%>

0 commit comments

Comments
 (0)