[dd-handler] Add `send_policy_tags` option
MODIFY
attributes/default.rb
attributes/default.rb
@@ -68,6 +68,9 @@ default['datadog']['collect_ec2_tags'] = nil
# EX: 'app_.*' allows all tags except those which look like app_.*
default['datadog']['tags_blacklist_regex'] = nil
+# Set to `true` if you want the handler to send the Chef policy name and group as host tags
+default['datadog']['send_policy_tags'] = false
+
# Autorestart agent
default['datadog']['autorestart'] = false

MODIFY
recipes/dd-handler.rb
recipes/dd-handler.rb
@@ -67,7 +67,8 @@ chef_handler 'Chef::Handler::Datadog' do # rubocop:disable Metrics/BlockLength
:tag_prefix => node['datadog']['tag_prefix'],
:url => node['datadog']['url'],
:extra_endpoints => extra_endpoints,
- :tags_blacklist_regex => node['datadog']['tags_blacklist_regex']
+ :tags_blacklist_regex => node['datadog']['tags_blacklist_regex'],
+ :send_policy_tags => node['datadog']['send_policy_tags']
}
unless node['datadog']['use_ec2_instance_id']

MODIFY
spec/dd-handler_spec.rb
spec/dd-handler_spec.rb
@@ -19,7 +19,8 @@ shared_examples 'a chef-handler-datadog runner' do |extra_endpoints, tags_blackl
tag_prefix: 'tag:',
url: 'https://app.datadoghq.com',
extra_endpoints: extra_endpoints || [],
- tags_blacklist_regex: tags_blacklist_regex
+ tags_blacklist_regex: tags_blacklist_regex,
+ send_policy_tags: false
}
expect(chef_run).to enable_chef_handler('Chef::Handler::Datadog').with(

[dd-handler] Add `send_policy_tags` option (#398)