diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fa3cf11..2145e38 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,3 +21,17 @@ If you'd like to run the test suite, fix a bug or add a feature, please follow t * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally. * Please try not to mess with the `Rakefile`, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it. + + +## Building and using local snapshots + +Sometimes you need to test chef-handler-datadog before a fix is merged. In this case you need to: + +* Set the version in `lib/chef_handler_datadog.rb` + If the current version is `0.11.0` then you should bump to `0.11.1.pre`. + This way when the next version is released it will take precedence over your snapshot. +* Run `rake build`, this will create the .gem file in the `pkg/` dir +* Copy the .gem file to your own gem server +* When you include `datadog::dd-handler` in your Chef runlist set `node.override['datadog']['gem_server']` to your gem server URL and `node.override['datadog']['chef_handler_version']` to your `.pre` version. +* Chef will install your version of the gem +* Don't forget to unset `gem_server` and `chef_handler_version` once the handler has been released with your changes diff --git a/lib/chef/handler/datadog.rb b/lib/chef/handler/datadog.rb index 31fe2c3..c283e1b 100644 --- a/lib/chef/handler/datadog.rb +++ b/lib/chef/handler/datadog.rb @@ -78,9 +78,9 @@ def send_report_to_datadog(dog) @metrics.emit_to_datadog dog @event.emit_to_datadog dog @tags.send_update_to_datadog dog - rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT => e - Chef::Log.error("Could not connect to Datadog. Connection error:\n" + e) - Chef::Log.error('Data to be submitted was:') + rescue => e + Chef::Log.error("Could not send/emit to Datadog:\n" + e) + Chef::Log.error('Event data to be submitted was:') Chef::Log.error(@event.event_title) Chef::Log.error(@event.event_body) Chef::Log.error('Tags to be set for this run:') @@ -134,7 +134,7 @@ def prepare_the_pack app_key, nil, # host nil, # device - true, # silent + false, # silent nil, # timeout url ))