Skip to content

Commit b7cc8c4

Browse files
DDRBoxmantruthbk
authored andcommitted
Config variable to enable the trace agent (#302)
1 parent 42e7d5f commit b7cc8c4

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

manifests/init.pp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@
151151
# $pup_log_file
152152
# Specifies the log file location for the pup system
153153
# String. Default: empty
154-
#
154+
# $apm_enabled
155+
# Boolean to enable or disable the trace agent
156+
# Boolean. Default: false
155157
#
156158
# Actions:
157159
#
@@ -238,6 +240,7 @@
238240
$package_name = $datadog_agent::params::package_name,
239241
$dd_user = $datadog_agent::params::dd_user,
240242
$dd_group = $datadog_agent::params::dd_group,
243+
$apm_enabled = false,
241244
) inherits datadog_agent::params {
242245

243246
validate_string($dd_url)
@@ -298,6 +301,7 @@
298301
validate_string($sd_template_dir)
299302
validate_bool($sd_jmx_enable)
300303
validate_string($consul_token)
304+
validate_bool($apm_enabled)
301305

302306
if $hiera_tags {
303307
$local_tags = hiera_array('datadog_agent::tags')

spec/classes/datadog_agent_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,12 @@
203203
'content' => /^# sd_jmx_enable: no\n/,
204204
)}
205205
end
206+
207+
context 'for APM' do
208+
it { should contain_file('/etc/dd-agent/datadog.conf').with(
209+
'content' => /^apm_enabled: false\n/,
210+
)}
211+
end
206212
end
207213

208214
context 'with user provided paramaters' do
@@ -500,6 +506,12 @@
500506
'content' => /^syslog_port: 8080\n/,
501507
)}
502508
end
509+
context 'with apm_enabled set to true' do
510+
let(:params) {{:apm_enabled => true }}
511+
it { should contain_file('/etc/dd-agent/datadog.conf').with(
512+
'content' => /^apm_enabled: true\n/,
513+
)}
514+
end
503515
context 'with service_discovery enabled' do
504516
let(:params) {
505517
{:service_discovery_backend => 'docker',

templates/datadog.conf.erb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,11 @@ sd_jmx_enable: <%= @sd_jmx_enable %>
401401
consul_token: <%= @consul_token %>
402402
<% end -%>
403403

404+
# ========================================================================== #
405+
# Trace #
406+
# ========================================================================== #
407+
408+
apm_enabled: <%= @apm_enabled %>
404409

405410
<% if not @extra_template.empty? -%>
406411

0 commit comments

Comments
 (0)