[handler] Allow configuring `tags_submission_retries` option
MODIFY
attributes/default.rb
attributes/default.rb
@@ -117,6 +117,11 @@ 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
+# Set to an integer if you want the handler to retry submitting tags if the host isn't yet present
+# on Datadog. The handler will retry evey 2 seconds until this number of retries is reached or the tags are
+# submitted successfully.
+default['datadog']['tags_submission_retries'] = nil
+
# Autorestart agent
default['datadog']['autorestart'] = false

MODIFY
recipes/dd-handler.rb
recipes/dd-handler.rb
@@ -61,7 +61,7 @@ chef_handler 'Chef::Handler::Datadog' do # rubocop:disable Metrics/BlockLength
extra_endpoints
end
- def handler_config # rubocop:disable Metrics/AbcSize
+ def handler_config # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
config = {
:api_key => Chef::Datadog.api_key(node),
:application_key => Chef::Datadog.application_key(node),
@@ -70,7 +70,8 @@ chef_handler 'Chef::Handler::Datadog' do # rubocop:disable Metrics/BlockLength
:url => node['datadog']['url'],
:extra_endpoints => extra_endpoints,
:tags_blacklist_regex => node['datadog']['tags_blacklist_regex'],
- :send_policy_tags => node['datadog']['send_policy_tags']
+ :send_policy_tags => node['datadog']['send_policy_tags'],
+ :tags_submission_retries => node['datadog']['tags_submission_retries']
}
unless node['datadog']['use_ec2_instance_id']

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

[handler] Allow configuring `tags_submission_retries` option (#508)