File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 154154# $apm_enabled
155155# Boolean to enable or disable the trace agent
156156# Boolean. Default: false
157+ # $apm_env
158+ # String defining the environment for the APM traces
159+ # String. Default: empty
157160#
158161# Actions:
159162#
241244 $dd_user = $datadog_agent::params::dd_user,
242245 $dd_group = $datadog_agent::params::dd_group,
243246 $apm_enabled = false ,
247+ $apm_env = ' ' ,
244248) inherits datadog_agent::params {
245249
246250 validate_string($dd_url )
302306 validate_bool($sd_jmx_enable )
303307 validate_string($consul_token )
304308 validate_bool($apm_enabled )
309+ validate_string($apm_env )
305310
306311 if $hiera_tags {
307312 $local_tags = hiera_array(' datadog_agent::tags' )
Original file line number Diff line number Diff line change 512512 'content' => /^apm_enabled: true\n / ,
513513 ) }
514514 end
515+ context 'with apm_enabled set to true and env specified' do
516+ let ( :params ) {
517+ { :apm_enabled => true ,
518+ :apm_env => 'foo' ,
519+ } }
520+ it { should contain_file ( '/etc/dd-agent/datadog.conf' ) . with (
521+ 'content' => /^apm_enabled: true\n / ,
522+ ) }
523+ it { should contain_file ( '/etc/dd-agent/datadog.conf' ) . with (
524+ 'content' => /^\[ trace.agent\] \n / ,
525+ ) }
526+ it { should contain_file ( '/etc/dd-agent/datadog.conf' ) . with (
527+ 'content' => /^env: foo\n / ,
528+ ) }
529+ end
515530 context 'with service_discovery enabled' do
516531 let ( :params ) {
517532 { :service_discovery_backend => 'docker' ,
Original file line number Diff line number Diff line change @@ -414,3 +414,8 @@ apm_enabled: <%= @apm_enabled %>
414414# ========================================================================== #
415415
416416<% end -%>
417+
418+ <% if not @apm_env.empty? -%>
419+ [trace.agent]
420+ env: <%= @apm_env %>
421+ <% end -%>
You can’t perform that action at this time.
0 commit comments