chef-handler-datadog 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/.env.example +2 -0
  3. data/CHANGELOG.md +15 -0
  4. data/Rakefile +7 -0
  5. data/lib/chef/handler/datadog.rb +1 -0
  6. data/lib/chef/handler/datadog_chef_metrics.rb +10 -1
  7. data/lib/chef/handler/datadog_chef_tags.rb +30 -9
  8. data/lib/chef_handler_datadog.rb +1 -1
  9. data/spec/datadog_spec.rb +74 -4
  10. data/spec/support/cassettes/Chef_Handler_Datadog/failed_Chef_run/sets_alert_handles_when_specified.yml +258 -122
  11. data/spec/support/cassettes/Chef_Handler_Datadog/failed_Chef_run/sets_event_title_correctly.yml +129 -61
  12. data/spec/support/cassettes/Chef_Handler_Datadog/failed_Chef_run/sets_priority_correctly.yml +129 -61
  13. data/spec/support/cassettes/Chef_Handler_Datadog/hostname/uses_the_node_name_when_no_config_specified.yml +124 -53
  14. data/spec/support/cassettes/Chef_Handler_Datadog/hostname/uses_the_specified_hostname_when_provided.yml +124 -53
  15. data/spec/support/cassettes/Chef_Handler_Datadog/reports_correct_hostname_on_an_ec2_node/does_not_use_the_instance_id_when_config_specified_to_false.yml +124 -53
  16. data/spec/support/cassettes/Chef_Handler_Datadog/reports_correct_hostname_on_an_ec2_node/uses_the_instance_id_when_config_is_specified.yml +124 -53
  17. data/spec/support/cassettes/Chef_Handler_Datadog/reports_correct_hostname_on_an_ec2_node/uses_the_instance_id_when_no_config_specified.yml +124 -53
  18. data/spec/support/cassettes/Chef_Handler_Datadog/reports_metrics_event_and_sets_tags/emits_events/posts_an_event.yml +124 -53
  19. data/spec/support/cassettes/Chef_Handler_Datadog/reports_metrics_event_and_sets_tags/emits_events/sets_priority_correctly.yml +124 -53
  20. data/spec/support/cassettes/Chef_Handler_Datadog/reports_metrics_event_and_sets_tags/emits_metrics/reports_metrics.yml +124 -53
  21. data/spec/support/cassettes/Chef_Handler_Datadog/reports_metrics_event_and_sets_tags/sets_tags/puts_the_tags_for_the_current_node.yml +124 -53
  22. data/spec/support/cassettes/Chef_Handler_Datadog/resources/failure_during_compile_phase/only_emits_a_failure_metric.yml +134 -0
  23. data/spec/support/cassettes/Chef_Handler_Datadog/resources/failure_during_compile_phase/posts_an_event.yml +77 -25
  24. data/spec/support/cassettes/Chef_Handler_Datadog/tags/when_specified/sets_the_role_and_env_and_tags.yml +89 -43
  25. data/spec/support/cassettes/Chef_Handler_Datadog/tags/when_unspecified/sets_role_env_and_nothing_else.yml +89 -42
  26. data/spec/support/cassettes/Chef_Handler_Datadog/tags_submission_retries/when_not_specified/does_not_retry_after_a_failed_submission.yml +241 -0
  27. data/spec/support/cassettes/Chef_Handler_Datadog/tags_submission_retries/when_specified_as_2_retries/retries_no_more_than_twice.yml +331 -0
  28. data/spec/support/cassettes/Chef_Handler_Datadog/tags_submission_retries/when_specified_as_2_retries/stops_retrying_once_submission_is_successful.yml +287 -0
  29. data/spec/support/cassettes/Chef_Handler_Datadog/updated_resources/posts_an_event.yml +126 -58
  30. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 345202254b0a6790a4ee591adfeceb1b6fe4987b
4
- data.tar.gz: 95b4da8f05b6179952e61a984ad683e83c11eae0
3
+ metadata.gz: 8c54065be2df326d6779153aaecf8bfaa3e078d6
4
+ data.tar.gz: 92eb9edaf6c4d5bcf82d0e4ee0f5bafcf9ffcf2c
5
5
  SHA512:
6
- metadata.gz: 672bc2ade623d4afda862b27b66d7301ea05ce1efe0404811bd9c99a36ce69c900e9cdd233165317c946f9891c23d313328c7effd8bb95185236b3043368ea00
7
- data.tar.gz: 1565a34fa7063abe4db33ee64b724c1a7189b2d8a5478bdb46e18d00ebf8ad07497f6862f772e3b97bb2859bae4f4ccd2847b36093565263c47f22456b69321f
6
+ metadata.gz: d76b01f151c3d3e4e20784ab2713f952621b83f5097ea1298dfe4f69e8ba318315298c090bc300915570b56afad4f13981bfc193b37133977e8d97ce2379e62b
7
+ data.tar.gz: e915c78a1b3689edb2691267b01288ee032494cce9d69143d7518c1aca8626ba8cced4ca7f954133e733e2ada8ede3326a85e7f9edf8dffb3fb408a06218be50
@@ -0,0 +1,2 @@
1
+ API_KEY: myapikey
2
+ APPLICATION_KEY: chefhandlerspecificapplicationkey
@@ -1,6 +1,13 @@
1
1
  Changes
2
2
  =======
3
3
 
4
+ # 0.8.0 / 2016-03-01
5
+
6
+ * [FEATURE] Add success/failure metric [#75][] [@jhulten][]
7
+ * [FEATURE] Retry tags submission when host is not yet present on DD [#80][] [@olivielpeau][]
8
+ * [OPTIMIZE] Ensure tags always returns an array [#78][] [@rlaveycal][]
9
+ * [OPTIMIZE] More robust failed chef run checking [#69][] [@bigbam505][]
10
+
4
11
  # 0.7.0 / 2015-10-22
5
12
 
6
13
  * [FEATURE] Support passing `DATADOG_PROXY` env var to control `dogapi` behavior, [#65][] [@datwiz][]
@@ -73,9 +80,17 @@ And all other versions were prior to this. See git history for more.
73
80
  [#60]: https://github.com/DataDog/chef-handler-datadog/issues/60
74
81
  [#65]: https://github.com/DataDog/chef-handler-datadog/issues/65
75
82
  [#66]: https://github.com/DataDog/chef-handler-datadog/issues/66
83
+ [#69]: https://github.com/DataDog/chef-handler-datadog/issues/69
84
+ [#75]: https://github.com/DataDog/chef-handler-datadog/issues/75
85
+ [#78]: https://github.com/DataDog/chef-handler-datadog/issues/78
86
+ [#80]: https://github.com/DataDog/chef-handler-datadog/issues/80
76
87
  [@alq]: https://github.com/alq
88
+ [@bigbam505]: https://github.com/bigbam505
77
89
  [@datwiz]: https://github.com/datwiz
78
90
  [@dwradcliffe]: https://github.com/dwradcliffe
91
+ [@jhulten]: https://github.com/jhulten
79
92
  [@miketheman]: https://github.com/miketheman
93
+ [@olivielpeau]: https://github.com/olivielpeau
80
94
  [@owen]: https://github.com/owen
81
95
  [@remh]: https://github.com/remh
96
+ [@rlaveycal]: https://github.com/rlaveycal
data/Rakefile CHANGED
@@ -14,3 +14,10 @@ CLEAN.include(['coverage/', 'doc/', 'pkg/'])
14
14
  RSpec::Core::RakeTask.new(:spec)
15
15
 
16
16
  RuboCop::RakeTask.new(:cops)
17
+
18
+ namespace :dev do
19
+ task :setup do
20
+ cp '.env.example', '.env'
21
+ Rake::Task[:default].invoke
22
+ end
23
+ end
@@ -55,6 +55,7 @@ class Chef
55
55
  .with_hostname(hostname)
56
56
  .with_run_status(run_status)
57
57
  .with_application_key(config[:application_key])
58
+ .with_retries(@config[:tags_submission_retries])
58
59
 
59
60
  # Build the chef event information
60
61
  @event =
@@ -38,10 +38,13 @@ class DatadogChefMetrics
38
38
 
39
39
  # Emit Chef metrics to Datadog
40
40
  def emit_to_datadog
41
+ # Send base success/failure metric
42
+ @dog.emit_point(@run_status.success? ? 'chef.run.success' : 'chef.run.failure', 1, host: @hostname, type: 'counter')
43
+
41
44
  # If there is a failure during compile phase, a large portion of
42
45
  # run_status may be unavailable. Bail out here
43
46
  warn_msg = 'Error during compile phase, no Datadog metrics available.'
44
- return Chef::Log.warn(warn_msg) if @run_status.elapsed_time.nil?
47
+ return Chef::Log.warn(warn_msg) if compile_error?
45
48
 
46
49
  @dog.emit_point('chef.resources.total', @run_status.all_resources.length, host: @hostname)
47
50
  @dog.emit_point('chef.resources.updated', @run_status.updated_resources.length, host: @hostname)
@@ -50,4 +53,10 @@ class DatadogChefMetrics
50
53
  rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT => e
51
54
  Chef::Log.error("Could not send metrics to Datadog. Connection error:\n" + e)
52
55
  end
56
+
57
+ private
58
+
59
+ def compile_error?
60
+ @run_status.all_resources.nil? || @run_status.elapsed_time.nil? || @run_status.updated_resources.nil?
61
+ end
53
62
  end # end class DatadogChefMetrics
@@ -10,6 +10,7 @@ class DatadogChefTags
10
10
  @node = nil
11
11
  @run_status = nil
12
12
  @application_key = nil
13
+ @retries = 0
13
14
  @combined_host_tags = nil
14
15
  end
15
16
 
@@ -76,19 +77,39 @@ class DatadogChefTags
76
77
  self
77
78
  end
78
79
 
80
+ # set the number of retries when sending tags, when the host is not yet present
81
+ # on Datadog
82
+ #
83
+ # @param retries [Integer] number of retries
84
+ # @return [DatadogChefTags] instance reference to self enabling method chaining
85
+ def with_retries(retries)
86
+ @retries = retries unless retries.nil?
87
+ self
88
+ end
89
+
79
90
  # send updated chef run generated tags to Datadog
80
91
  def send_update_to_datadog
81
- rc = @dog.update_tags(@hostname, combined_host_tags, 'chef')
92
+ retries = @retries
82
93
  begin
83
- # See FIXME above about why I feel dirty repeating this code here
84
- if rc.length < 2
85
- Chef::Log.warn("Unexpected response from Datadog Event API: #{rc}")
86
- else
87
- if rc[0].to_i / 100 != 2
88
- Chef::Log.warn("Could not submit #{combined_host_tags} tags for #{@hostname} to Datadog: #{rc}")
94
+ loop do
95
+ should_retry = false
96
+ rc = @dog.update_tags(@hostname, combined_host_tags, 'chef')
97
+ # See FIXME in DatadogChefEvents::emit_to_datadog about why I feel dirty repeating this code here
98
+ if rc.length < 2
99
+ Chef::Log.warn("Unexpected response from Datadog Tags API: #{rc}")
89
100
  else
90
- Chef::Log.debug("Successfully updated #{@hostname}'s tags to #{combined_host_tags.join(', ')}")
101
+ if retries > 0 && rc[0].to_i == 404
102
+ Chef::Log.debug("Host #{@hostname} not yet present on Datadog, re-submitting tags in 2 seconds")
103
+ sleep 2
104
+ retries -= 1
105
+ should_retry = true
106
+ elsif rc[0].to_i / 100 != 2
107
+ Chef::Log.warn("Could not submit #{combined_host_tags} tags for #{@hostname} to Datadog: #{rc}")
108
+ else
109
+ Chef::Log.debug("Successfully updated #{@hostname}'s tags to #{combined_host_tags.join(', ')}")
110
+ end
91
111
  end
112
+ break unless should_retry
92
113
  end
93
114
  rescue
94
115
  Chef::Log.warn("Could not determine whether #{@hostname}'s tags were successfully submitted to Datadog: #{rc}")
@@ -106,6 +127,6 @@ class DatadogChefTags
106
127
  end
107
128
 
108
129
  def node_tags
109
- @node.tags.map! { |tag| 'tag:' + tag } if @node.tags
130
+ @node.tags ? @node.tags.map! { |tag| 'tag:' + tag } : []
110
131
  end
111
132
  end # end class DatadogChefTags
@@ -2,5 +2,5 @@
2
2
  # Helper module for version number only.
3
3
  # Real deal in 'chef/handler/datadog.rb'
4
4
  module ChefHandlerDatadog
5
- VERSION = '0.7.0'
5
+ VERSION = '0.8.0'
6
6
  end
@@ -56,7 +56,7 @@ describe Chef::Handler::Datadog, :vcr => :new_episodes do
56
56
  it 'reports metrics' do
57
57
  expect(a_request(:post, METRICS_ENDPOINT).with(
58
58
  :query => { 'api_key' => @handler.config[:api_key] }
59
- )).to have_been_made.times(3)
59
+ )).to have_been_made.times(4)
60
60
  end
61
61
  end
62
62
 
@@ -233,6 +233,76 @@ describe Chef::Handler::Datadog, :vcr => :new_episodes do
233
233
  end
234
234
  end
235
235
 
236
+ context 'tags submission retries' do
237
+ before(:each) do
238
+ @node = Chef::Node.build('chef.handler.datadog.test-tags-retries')
239
+
240
+ @node.send(:chef_environment, 'hostile')
241
+ @node.send(:run_list, 'role[highlander]')
242
+ @node.normal.tags = ['the_one_and_only']
243
+
244
+ @events = Chef::EventDispatch::Dispatcher.new
245
+ @run_context = Chef::RunContext.new(@node, {}, @events)
246
+ @run_status = Chef::RunStatus.new(@node, @events)
247
+
248
+ @expected_time = Time.now
249
+ allow(Time).to receive(:now).and_return(@expected_time, @expected_time + 5)
250
+ @run_status.start_clock
251
+ @run_status.stop_clock
252
+
253
+ @run_status.run_context = @run_context
254
+ end
255
+
256
+ describe 'when specified as 2 retries' do
257
+ before(:each) do
258
+ @handler.config[:tags_submission_retries] = 2
259
+ # Stub `sleep` to avoid slowing down the execution
260
+ allow_any_instance_of(DatadogChefTags).to receive(:sleep)
261
+ end
262
+
263
+ it 'retries no more than twice' do
264
+ @handler.run_report_unsafe(@run_status)
265
+
266
+ expect(a_request(:put, HOST_TAG_ENDPOINT + @node.name).with(
267
+ :query => { 'api_key' => @handler.config[:api_key],
268
+ 'application_key' => @handler.config[:application_key],
269
+ 'source' => 'chef' },
270
+ :body => hash_including(:tags => [
271
+ 'env:hostile', 'role:highlander', 'tag:the_one_and_only'
272
+ ]),
273
+ )).to have_been_made.times(3)
274
+ end
275
+
276
+ it 'stops retrying once submission is successful' do
277
+ @handler.run_report_unsafe(@run_status)
278
+
279
+ expect(a_request(:put, HOST_TAG_ENDPOINT + @node.name).with(
280
+ :query => { 'api_key' => @handler.config[:api_key],
281
+ 'application_key' => @handler.config[:application_key],
282
+ 'source' => 'chef' },
283
+ :body => hash_including(:tags => [
284
+ 'env:hostile', 'role:highlander', 'tag:the_one_and_only'
285
+ ]),
286
+ )).to have_been_made.times(2)
287
+ end
288
+ end
289
+
290
+ describe 'when not specified' do
291
+ it 'does not retry after a failed submission' do
292
+ @handler.run_report_unsafe(@run_status)
293
+
294
+ expect(a_request(:put, HOST_TAG_ENDPOINT + @node.name).with(
295
+ :query => { 'api_key' => @handler.config[:api_key],
296
+ 'application_key' => @handler.config[:application_key],
297
+ 'source' => 'chef' },
298
+ :body => hash_including(:tags => [
299
+ 'env:hostile', 'role:highlander', 'tag:the_one_and_only'
300
+ ]),
301
+ )).to have_been_made.times(1)
302
+ end
303
+ end
304
+ end
305
+
236
306
  describe 'handles no application_key' do
237
307
  before(:each) do
238
308
  @node = Chef::Node.build('chef.handler.datadog.test-noapp')
@@ -373,10 +443,10 @@ describe Chef::Handler::Datadog, :vcr => :new_episodes do
373
443
  @handler.run_report_unsafe(@run_status)
374
444
  end
375
445
 
376
- it 'does not emit metrics' do
446
+ it 'only emits a failure metric' do
377
447
  expect(a_request(:post, METRICS_ENDPOINT).with(
378
448
  :query => { 'api_key' => @handler.config[:api_key] }
379
- )).to_not have_been_made
449
+ )).to have_been_made.times(1)
380
450
  end
381
451
 
382
452
  it 'posts an event' do
@@ -387,7 +457,7 @@ describe Chef::Handler::Datadog, :vcr => :new_episodes do
387
457
  )).to have_been_made.times(1)
388
458
  end
389
459
  end
390
- end
460
+ end
391
461
 
392
462
  # TODO: test failures:
393
463
  # @run_status.exception = Exception.new('Boy howdy!')
@@ -5,10 +5,12 @@ http_interactions:
5
5
  uri: https://app.datadoghq.com/api/v1/series?api_key=<API_KEY>
6
6
  body:
7
7
  encoding: UTF-8
8
- string: ! '{"series":[{"metric":"chef.resources.total","points":[[1410264911,6.0]],"type":"gauge","host":"chef.handler.datadog.test-failed","device":null}]}'
8
+ string: '{"series":[{"metric":"chef.run.failure","points":[[1453838668,1.0]],"type":"counter","host":"chef.handler.datadog.test-failed","device":null}]}'
9
9
  headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
10
12
  Accept:
11
- - ! '*/*'
13
+ - "*/*"
12
14
  User-Agent:
13
15
  - Ruby
14
16
  Content-Type:
@@ -19,29 +21,74 @@ http_interactions:
19
21
  message: Accepted
20
22
  headers:
21
23
  Content-Type:
22
- - text/json; charset=UTF-8
24
+ - text/json
23
25
  Date:
24
- - Tue, 09 Sep 2014 12:15:09 GMT
25
- Server:
26
- - dogdispatcher/5.2.0
26
+ - Tue, 26 Jan 2016 20:04:26 GMT
27
+ Dd-Pool:
28
+ - propjoe
29
+ Strict-Transport-Security:
30
+ - max-age=15724800;
31
+ X-Content-Type-Options:
32
+ - nosniff
27
33
  Content-Length:
28
- - '15'
34
+ - '16'
29
35
  Connection:
30
36
  - keep-alive
31
37
  body:
32
- encoding: US-ASCII
33
- string: ! '{"status":"ok"}'
38
+ encoding: UTF-8
39
+ string: '{"status": "ok"}'
40
+ http_version:
41
+ recorded_at: Tue, 26 Jan 2016 20:04:28 GMT
42
+ - request:
43
+ method: post
44
+ uri: https://app.datadoghq.com/api/v1/series?api_key=<API_KEY>
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"series":[{"metric":"chef.resources.total","points":[[1453838668,6.0]],"type":"gauge","host":"chef.handler.datadog.test-failed","device":null}]}'
48
+ headers:
49
+ Accept-Encoding:
50
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
51
+ Accept:
52
+ - "*/*"
53
+ User-Agent:
54
+ - Ruby
55
+ Content-Type:
56
+ - application/json
57
+ response:
58
+ status:
59
+ code: 202
60
+ message: Accepted
61
+ headers:
62
+ Content-Type:
63
+ - text/json
64
+ Date:
65
+ - Tue, 26 Jan 2016 20:04:26 GMT
66
+ Dd-Pool:
67
+ - propjoe
68
+ Strict-Transport-Security:
69
+ - max-age=15724800;
70
+ X-Content-Type-Options:
71
+ - nosniff
72
+ Content-Length:
73
+ - '16'
74
+ Connection:
75
+ - keep-alive
76
+ body:
77
+ encoding: UTF-8
78
+ string: '{"status": "ok"}'
34
79
  http_version:
35
- recorded_at: Tue, 09 Sep 2014 12:15:11 GMT
80
+ recorded_at: Tue, 26 Jan 2016 20:04:28 GMT
36
81
  - request:
37
82
  method: post
38
83
  uri: https://app.datadoghq.com/api/v1/series?api_key=<API_KEY>
39
84
  body:
40
85
  encoding: UTF-8
41
- string: ! '{"series":[{"metric":"chef.resources.updated","points":[[1410264911,6.0]],"type":"gauge","host":"chef.handler.datadog.test-failed","device":null}]}'
86
+ string: '{"series":[{"metric":"chef.resources.updated","points":[[1453838668,6.0]],"type":"gauge","host":"chef.handler.datadog.test-failed","device":null}]}'
42
87
  headers:
88
+ Accept-Encoding:
89
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
43
90
  Accept:
44
- - ! '*/*'
91
+ - "*/*"
45
92
  User-Agent:
46
93
  - Ruby
47
94
  Content-Type:
@@ -52,29 +99,35 @@ http_interactions:
52
99
  message: Accepted
53
100
  headers:
54
101
  Content-Type:
55
- - text/json; charset=UTF-8
102
+ - text/json
56
103
  Date:
57
- - Tue, 09 Sep 2014 12:15:09 GMT
58
- Server:
59
- - dogdispatcher/5.1.1
104
+ - Tue, 26 Jan 2016 20:04:26 GMT
105
+ Dd-Pool:
106
+ - propjoe
107
+ Strict-Transport-Security:
108
+ - max-age=15724800;
109
+ X-Content-Type-Options:
110
+ - nosniff
60
111
  Content-Length:
61
- - '15'
112
+ - '16'
62
113
  Connection:
63
114
  - keep-alive
64
115
  body:
65
- encoding: US-ASCII
66
- string: ! '{"status":"ok"}'
116
+ encoding: UTF-8
117
+ string: '{"status": "ok"}'
67
118
  http_version:
68
- recorded_at: Tue, 09 Sep 2014 12:15:11 GMT
119
+ recorded_at: Tue, 26 Jan 2016 20:04:28 GMT
69
120
  - request:
70
121
  method: post
71
122
  uri: https://app.datadoghq.com/api/v1/series?api_key=<API_KEY>
72
123
  body:
73
124
  encoding: UTF-8
74
- string: ! '{"series":[{"metric":"chef.resources.elapsed_time","points":[[1410264911,2.0]],"type":"gauge","host":"chef.handler.datadog.test-failed","device":null}]}'
125
+ string: '{"series":[{"metric":"chef.resources.elapsed_time","points":[[1453838668,2.0]],"type":"gauge","host":"chef.handler.datadog.test-failed","device":null}]}'
75
126
  headers:
127
+ Accept-Encoding:
128
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
76
129
  Accept:
77
- - ! '*/*'
130
+ - "*/*"
78
131
  User-Agent:
79
132
  - Ruby
80
133
  Content-Type:
@@ -85,38 +138,43 @@ http_interactions:
85
138
  message: Accepted
86
139
  headers:
87
140
  Content-Type:
88
- - text/json; charset=UTF-8
141
+ - text/json
89
142
  Date:
90
- - Tue, 09 Sep 2014 12:15:10 GMT
91
- Server:
92
- - dogdispatcher/5.1.1
143
+ - Tue, 26 Jan 2016 20:04:26 GMT
144
+ Dd-Pool:
145
+ - propjoe
146
+ Strict-Transport-Security:
147
+ - max-age=15724800;
148
+ X-Content-Type-Options:
149
+ - nosniff
93
150
  Content-Length:
94
- - '15'
151
+ - '16'
95
152
  Connection:
96
153
  - keep-alive
97
154
  body:
98
- encoding: US-ASCII
99
- string: ! '{"status":"ok"}'
155
+ encoding: UTF-8
156
+ string: '{"status": "ok"}'
100
157
  http_version:
101
- recorded_at: Tue, 09 Sep 2014 12:15:11 GMT
158
+ recorded_at: Tue, 26 Jan 2016 20:04:28 GMT
102
159
  - request:
103
160
  method: post
104
161
  uri: https://app.datadoghq.com/api/v1/events?api_key=<API_KEY>
105
162
  body:
106
163
  encoding: UTF-8
107
- string: ! '{"msg_text":"Chef updated 6 resources out of 6 resources total.\n$$$\n-
164
+ string: '{"msg_text":"\n$$$\n- [paws] (dynamically defined)\n- [ears] (dynamically
165
+ defined)\n- [nose] (dynamically defined)\n- [tail] (dynamically defined)\n-
166
+ [fur] (dynamically defined)\n\n$$$\n\n$$$\nChef::Exceptions::UnsupportedAction:
167
+ Something awry.\n$$$\n\n$$$\nwhiskers.rb:2\npaws.rb:1\nfile.rb:2\nfile.rb:1\n$$$\n","date_happened":1453838668,"msg_title":"Chef
168
+ failed in 2 seconds on chef.handler.datadog.test-failed ","priority":"normal","parent":null,"tags":["env:hostile","role:highlander","tag:the_one_and_only"],"aggregation_key":"chef.handler.datadog.test-failed","alert_type":"error","event_type":"config_management.run","source_type_name":"chef","title":"Chef
169
+ failed in 2 seconds on chef.handler.datadog.test-failed ","text":"\n$$$\n-
108
170
  [paws] (dynamically defined)\n- [ears] (dynamically defined)\n- [nose] (dynamically
109
171
  defined)\n- [tail] (dynamically defined)\n- [fur] (dynamically defined)\n\n$$$\n\n$$$\nChef::Exceptions::UnsupportedAction:
110
- Something awry.\n$$$\n\n$$$\nwhiskers.rb:2\npaws.rb:1\nfile.rb:2\nfile.rb:1\n$$$\n","date_happened":1410264911,"msg_title":"Chef
111
- failed in 2 seconds on chef.handler.datadog.test-failed ","priority":"normal","parent":null,"tags":["env:hostile","role:highlander","tag:the_one_and_only"],"aggregation_key":"chef.handler.datadog.test-failed","alert_type":"error","event_type":"config_management.run","source_type_name":"chef","title":"Chef
112
- failed in 2 seconds on chef.handler.datadog.test-failed ","text":"Chef updated
113
- 6 resources out of 6 resources total.\n$$$\n- [paws] (dynamically defined)\n-
114
- [ears] (dynamically defined)\n- [nose] (dynamically defined)\n- [tail] (dynamically
115
- defined)\n- [fur] (dynamically defined)\n\n$$$\n\n$$$\nChef::Exceptions::UnsupportedAction:
116
172
  Something awry.\n$$$\n\n$$$\nwhiskers.rb:2\npaws.rb:1\nfile.rb:2\nfile.rb:1\n$$$\n","host":"chef.handler.datadog.test-failed","device":null}'
117
173
  headers:
174
+ Accept-Encoding:
175
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
118
176
  Accept:
119
- - ! '*/*'
177
+ - "*/*"
120
178
  User-Agent:
121
179
  - Ruby
122
180
  Content-Type:
@@ -127,37 +185,39 @@ http_interactions:
127
185
  message: Accepted
128
186
  headers:
129
187
  Content-Type:
130
- - text/json; charset=UTF-8
188
+ - text/plain; charset=utf-8
131
189
  Date:
132
- - Tue, 09 Sep 2014 12:15:11 GMT
133
- Server:
134
- - dogdispatcher/5.2.0
190
+ - Tue, 26 Jan 2016 20:04:26 GMT
191
+ Dd-Pool:
192
+ - propjoe
193
+ Strict-Transport-Security:
194
+ - max-age=15724800;
195
+ X-Content-Type-Options:
196
+ - nosniff
135
197
  Content-Length:
136
- - '729'
198
+ - '647'
137
199
  Connection:
138
200
  - keep-alive
139
201
  body:
140
- encoding: US-ASCII
141
- string: ! '{"status": "ok", "event": {"priority": "normal", "date_happened":
142
- 1410264911, "handle": null, "title": "Chef failed in 2 seconds on chef.handler.datadog.test-failed
143
- ", "url": "https://app.datadoghq.com/event/jump_to?event_id=2449507845826654380",
144
- "text": "Chef updated 6 resources out of 6 resources total.\n$$$\n- [paws]
202
+ encoding: UTF-8
203
+ string: '{"status":"ok","event":{"id":381236694692316426,"title":"Chef failed
204
+ in 2 seconds on chef.handler.datadog.test-failed ","text":"\n$$$\n- [paws]
145
205
  (dynamically defined)\n- [ears] (dynamically defined)\n- [nose] (dynamically
146
206
  defined)\n- [tail] (dynamically defined)\n- [fur] (dynamically defined)\n\n$$$\n\n$$$\nChef::Exceptions::UnsupportedAction:
147
- Something awry.\n$$$\n\n$$$\nwhiskers.rb:2\npaws.rb:1\nfile.rb:2\nfile.rb:1\n$$$\n",
148
- "tags": ["env:hostile", "role:highlander", "tag:the_one_and_only"], "related_event_id":
149
- null, "id": 2449507845826654380}}'
207
+ Something awry.\n$$$\n\n$$$\nwhiskers.rb:2\npaws.rb:1\nfile.rb:2\nfile.rb:1\n$$$\n","date_happened":1453838668,"handle":null,"priority":"normal","related_event_id":null,"tags":["env:hostile","role:highlander","tag:the_one_and_only"],"url":"https://app.datadoghq.com/event/event?id=381236694692316426"}}'
150
208
  http_version:
151
- recorded_at: Tue, 09 Sep 2014 12:15:11 GMT
209
+ recorded_at: Tue, 26 Jan 2016 20:04:28 GMT
152
210
  - request:
153
211
  method: put
154
212
  uri: https://app.datadoghq.com/api/v1/tags/hosts/chef.handler.datadog.test-failed?api_key=<API_KEY>&application_key=<APPLICATION_KEY>&source=chef
155
213
  body:
156
214
  encoding: UTF-8
157
- string: ! '{"tags":["env:hostile","role:highlander","tag:the_one_and_only"]}'
215
+ string: '{"tags":["env:hostile","role:highlander","tag:the_one_and_only"]}'
158
216
  headers:
217
+ Accept-Encoding:
218
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
159
219
  Accept:
160
- - ! '*/*'
220
+ - "*/*"
161
221
  User-Agent:
162
222
  - Ruby
163
223
  Content-Type:
@@ -172,30 +232,40 @@ http_interactions:
172
232
  Content-Type:
173
233
  - application/json
174
234
  Date:
175
- - Tue, 09 Sep 2014 12:15:11 GMT
235
+ - Tue, 26 Jan 2016 20:04:26 GMT
236
+ Dd-Pool:
237
+ - dogweb_sameorig
176
238
  Pragma:
177
239
  - no-cache
178
- Server:
179
- - gunicorn/19.1.0
240
+ Strict-Transport-Security:
241
+ - max-age=15724800;
242
+ X-Content-Type-Options:
243
+ - nosniff
244
+ X-Dd-Debug:
245
+ - 4G6DflkbLuEPHPN7r5QLLJW1+B1YXxXufb+VXQ5hU44=
246
+ X-Frame-Options:
247
+ - SAMEORIGIN
180
248
  Content-Length:
181
249
  - '112'
182
250
  Connection:
183
251
  - keep-alive
184
252
  body:
185
- encoding: US-ASCII
186
- string: ! '{"host": "chef.handler.datadog.test-failed", "tags": ["env:hostile",
253
+ encoding: UTF-8
254
+ string: '{"host": "chef.handler.datadog.test-failed", "tags": ["env:hostile",
187
255
  "role:highlander", "tag:the_one_and_only"]}'
188
256
  http_version:
189
- recorded_at: Tue, 09 Sep 2014 12:15:11 GMT
257
+ recorded_at: Tue, 26 Jan 2016 20:04:28 GMT
190
258
  - request:
191
259
  method: post
192
260
  uri: https://app.datadoghq.com/api/v1/series?api_key=<API_KEY>
193
261
  body:
194
262
  encoding: UTF-8
195
- string: ! '{"series":[{"metric":"chef.resources.total","points":[[1410264911,6.0]],"type":"gauge","host":"chef.handler.datadog.test-failed","device":null}]}'
263
+ string: '{"series":[{"metric":"chef.run.failure","points":[[1453838668,1.0]],"type":"counter","host":"chef.handler.datadog.test-failed","device":null}]}'
196
264
  headers:
265
+ Accept-Encoding:
266
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
197
267
  Accept:
198
- - ! '*/*'
268
+ - "*/*"
199
269
  User-Agent:
200
270
  - Ruby
201
271
  Content-Type:
@@ -206,29 +276,35 @@ http_interactions:
206
276
  message: Accepted
207
277
  headers:
208
278
  Content-Type:
209
- - text/json; charset=UTF-8
279
+ - text/json
210
280
  Date:
211
- - Tue, 09 Sep 2014 12:15:12 GMT
212
- Server:
213
- - dogdispatcher/5.1.1
281
+ - Tue, 26 Jan 2016 20:04:26 GMT
282
+ Dd-Pool:
283
+ - propjoe
284
+ Strict-Transport-Security:
285
+ - max-age=15724800;
286
+ X-Content-Type-Options:
287
+ - nosniff
214
288
  Content-Length:
215
- - '15'
289
+ - '16'
216
290
  Connection:
217
291
  - keep-alive
218
292
  body:
219
- encoding: US-ASCII
220
- string: ! '{"status":"ok"}'
293
+ encoding: UTF-8
294
+ string: '{"status": "ok"}'
221
295
  http_version:
222
- recorded_at: Tue, 09 Sep 2014 12:15:11 GMT
296
+ recorded_at: Tue, 26 Jan 2016 20:04:28 GMT
223
297
  - request:
224
298
  method: post
225
299
  uri: https://app.datadoghq.com/api/v1/series?api_key=<API_KEY>
226
300
  body:
227
301
  encoding: UTF-8
228
- string: ! '{"series":[{"metric":"chef.resources.updated","points":[[1410264911,6.0]],"type":"gauge","host":"chef.handler.datadog.test-failed","device":null}]}'
302
+ string: '{"series":[{"metric":"chef.resources.total","points":[[1453838668,6.0]],"type":"gauge","host":"chef.handler.datadog.test-failed","device":null}]}'
229
303
  headers:
304
+ Accept-Encoding:
305
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
230
306
  Accept:
231
- - ! '*/*'
307
+ - "*/*"
232
308
  User-Agent:
233
309
  - Ruby
234
310
  Content-Type:
@@ -239,29 +315,35 @@ http_interactions:
239
315
  message: Accepted
240
316
  headers:
241
317
  Content-Type:
242
- - text/json; charset=UTF-8
318
+ - text/json
243
319
  Date:
244
- - Tue, 09 Sep 2014 12:15:12 GMT
245
- Server:
246
- - dogdispatcher/5.1.1
320
+ - Tue, 26 Jan 2016 20:04:26 GMT
321
+ Dd-Pool:
322
+ - propjoe
323
+ Strict-Transport-Security:
324
+ - max-age=15724800;
325
+ X-Content-Type-Options:
326
+ - nosniff
247
327
  Content-Length:
248
- - '15'
328
+ - '16'
249
329
  Connection:
250
330
  - keep-alive
251
331
  body:
252
- encoding: US-ASCII
253
- string: ! '{"status":"ok"}'
332
+ encoding: UTF-8
333
+ string: '{"status": "ok"}'
254
334
  http_version:
255
- recorded_at: Tue, 09 Sep 2014 12:15:11 GMT
335
+ recorded_at: Tue, 26 Jan 2016 20:04:28 GMT
256
336
  - request:
257
337
  method: post
258
338
  uri: https://app.datadoghq.com/api/v1/series?api_key=<API_KEY>
259
339
  body:
260
340
  encoding: UTF-8
261
- string: ! '{"series":[{"metric":"chef.resources.elapsed_time","points":[[1410264911,2.0]],"type":"gauge","host":"chef.handler.datadog.test-failed","device":null}]}'
341
+ string: '{"series":[{"metric":"chef.resources.updated","points":[[1453838668,6.0]],"type":"gauge","host":"chef.handler.datadog.test-failed","device":null}]}'
262
342
  headers:
343
+ Accept-Encoding:
344
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
263
345
  Accept:
264
- - ! '*/*'
346
+ - "*/*"
265
347
  User-Agent:
266
348
  - Ruby
267
349
  Content-Type:
@@ -272,38 +354,82 @@ http_interactions:
272
354
  message: Accepted
273
355
  headers:
274
356
  Content-Type:
275
- - text/json; charset=UTF-8
357
+ - text/json
276
358
  Date:
277
- - Tue, 09 Sep 2014 12:15:13 GMT
278
- Server:
279
- - dogdispatcher/5.1.1
359
+ - Tue, 26 Jan 2016 20:04:27 GMT
360
+ Dd-Pool:
361
+ - propjoe
362
+ Strict-Transport-Security:
363
+ - max-age=15724800;
364
+ X-Content-Type-Options:
365
+ - nosniff
280
366
  Content-Length:
281
- - '15'
367
+ - '16'
282
368
  Connection:
283
369
  - keep-alive
284
370
  body:
285
- encoding: US-ASCII
286
- string: ! '{"status":"ok"}'
371
+ encoding: UTF-8
372
+ string: '{"status": "ok"}'
287
373
  http_version:
288
- recorded_at: Tue, 09 Sep 2014 12:15:11 GMT
374
+ recorded_at: Tue, 26 Jan 2016 20:04:28 GMT
375
+ - request:
376
+ method: post
377
+ uri: https://app.datadoghq.com/api/v1/series?api_key=<API_KEY>
378
+ body:
379
+ encoding: UTF-8
380
+ string: '{"series":[{"metric":"chef.resources.elapsed_time","points":[[1453838668,2.0]],"type":"gauge","host":"chef.handler.datadog.test-failed","device":null}]}'
381
+ headers:
382
+ Accept-Encoding:
383
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
384
+ Accept:
385
+ - "*/*"
386
+ User-Agent:
387
+ - Ruby
388
+ Content-Type:
389
+ - application/json
390
+ response:
391
+ status:
392
+ code: 202
393
+ message: Accepted
394
+ headers:
395
+ Content-Type:
396
+ - text/json
397
+ Date:
398
+ - Tue, 26 Jan 2016 20:04:27 GMT
399
+ Dd-Pool:
400
+ - propjoe
401
+ Strict-Transport-Security:
402
+ - max-age=15724800;
403
+ X-Content-Type-Options:
404
+ - nosniff
405
+ Content-Length:
406
+ - '16'
407
+ Connection:
408
+ - keep-alive
409
+ body:
410
+ encoding: UTF-8
411
+ string: '{"status": "ok"}'
412
+ http_version:
413
+ recorded_at: Tue, 26 Jan 2016 20:04:28 GMT
289
414
  - request:
290
415
  method: post
291
416
  uri: https://app.datadoghq.com/api/v1/events?api_key=<API_KEY>
292
417
  body:
293
418
  encoding: UTF-8
294
- string: ! '{"msg_text":"Chef updated 6 resources out of 6 resources total.\n$$$\n-
419
+ string: '{"msg_text":"\n$$$\n- [paws] (dynamically defined)\n- [ears] (dynamically
420
+ defined)\n- [nose] (dynamically defined)\n- [tail] (dynamically defined)\n-
421
+ [fur] (dynamically defined)\n\n$$$\n\nAlerting: @alice @bob\n\n$$$\nChef::Exceptions::UnsupportedAction:
422
+ Something awry.\n$$$\n\n$$$\nwhiskers.rb:2\npaws.rb:1\nfile.rb:2\nfile.rb:1\n$$$\n","date_happened":1453838668,"msg_title":"Chef
423
+ failed in 2 seconds on chef.handler.datadog.test-failed ","priority":"normal","parent":null,"tags":["env:hostile","role:highlander","tag:tag:the_one_and_only"],"aggregation_key":"chef.handler.datadog.test-failed","alert_type":"error","event_type":"config_management.run","source_type_name":"chef","title":"Chef
424
+ failed in 2 seconds on chef.handler.datadog.test-failed ","text":"\n$$$\n-
295
425
  [paws] (dynamically defined)\n- [ears] (dynamically defined)\n- [nose] (dynamically
296
426
  defined)\n- [tail] (dynamically defined)\n- [fur] (dynamically defined)\n\n$$$\n\nAlerting:
297
- @alice @bob\n\n$$$\nChef::Exceptions::UnsupportedAction: Something awry.\n$$$\n\n$$$\nwhiskers.rb:2\npaws.rb:1\nfile.rb:2\nfile.rb:1\n$$$\n","date_happened":1410264911,"msg_title":"Chef
298
- failed in 2 seconds on chef.handler.datadog.test-failed ","priority":"normal","parent":null,"tags":["env:hostile","role:highlander","tag:tag:the_one_and_only"],"aggregation_key":"chef.handler.datadog.test-failed","alert_type":"error","event_type":"config_management.run","source_type_name":"chef","title":"Chef
299
- failed in 2 seconds on chef.handler.datadog.test-failed ","text":"Chef updated
300
- 6 resources out of 6 resources total.\n$$$\n- [paws] (dynamically defined)\n-
301
- [ears] (dynamically defined)\n- [nose] (dynamically defined)\n- [tail] (dynamically
302
- defined)\n- [fur] (dynamically defined)\n\n$$$\n\nAlerting: @alice @bob\n\n$$$\nChef::Exceptions::UnsupportedAction:
303
- Something awry.\n$$$\n\n$$$\nwhiskers.rb:2\npaws.rb:1\nfile.rb:2\nfile.rb:1\n$$$\n","host":"chef.handler.datadog.test-failed","device":null}'
427
+ @alice @bob\n\n$$$\nChef::Exceptions::UnsupportedAction: Something awry.\n$$$\n\n$$$\nwhiskers.rb:2\npaws.rb:1\nfile.rb:2\nfile.rb:1\n$$$\n","host":"chef.handler.datadog.test-failed","device":null}'
304
428
  headers:
429
+ Accept-Encoding:
430
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
305
431
  Accept:
306
- - ! '*/*'
432
+ - "*/*"
307
433
  User-Agent:
308
434
  - Ruby
309
435
  Content-Type:
@@ -314,37 +440,39 @@ http_interactions:
314
440
  message: Accepted
315
441
  headers:
316
442
  Content-Type:
317
- - text/json; charset=UTF-8
443
+ - text/plain; charset=utf-8
318
444
  Date:
319
- - Tue, 09 Sep 2014 12:15:13 GMT
320
- Server:
321
- - dogdispatcher/5.2.0
445
+ - Tue, 26 Jan 2016 20:04:27 GMT
446
+ Dd-Pool:
447
+ - propjoe
448
+ Strict-Transport-Security:
449
+ - max-age=15724800;
450
+ X-Content-Type-Options:
451
+ - nosniff
322
452
  Content-Length:
323
- - '758'
453
+ - '676'
324
454
  Connection:
325
455
  - keep-alive
326
456
  body:
327
- encoding: US-ASCII
328
- string: ! '{"status": "ok", "event": {"priority": "normal", "date_happened":
329
- 1410264911, "handle": null, "title": "Chef failed in 2 seconds on chef.handler.datadog.test-failed
330
- ", "url": "https://app.datadoghq.com/event/jump_to?event_id=2449507892182102265",
331
- "text": "Chef updated 6 resources out of 6 resources total.\n$$$\n- [paws]
457
+ encoding: UTF-8
458
+ string: '{"status":"ok","event":{"id":381236701686654829,"title":"Chef failed
459
+ in 2 seconds on chef.handler.datadog.test-failed ","text":"\n$$$\n- [paws]
332
460
  (dynamically defined)\n- [ears] (dynamically defined)\n- [nose] (dynamically
333
461
  defined)\n- [tail] (dynamically defined)\n- [fur] (dynamically defined)\n\n$$$\n\nAlerting:
334
- @alice @bob\n\n$$$\nChef::Exceptions::UnsupportedAction: Something awry.\n$$$\n\n$$$\nwhiskers.rb:2\npaws.rb:1\nfile.rb:2\nfile.rb:1\n$$$\n",
335
- "tags": ["env:hostile", "role:highlander", "tag:tag:the_one_and_only"], "related_event_id":
336
- null, "id": 2449507892182102265}}'
462
+ @alice @bob\n\n$$$\nChef::Exceptions::UnsupportedAction: Something awry.\n$$$\n\n$$$\nwhiskers.rb:2\npaws.rb:1\nfile.rb:2\nfile.rb:1\n$$$\n","date_happened":1453838668,"handle":null,"priority":"normal","related_event_id":null,"tags":["env:hostile","role:highlander","tag:tag:the_one_and_only"],"url":"https://app.datadoghq.com/event/event?id=381236701686654829"}}'
337
463
  http_version:
338
- recorded_at: Tue, 09 Sep 2014 12:15:11 GMT
464
+ recorded_at: Tue, 26 Jan 2016 20:04:28 GMT
339
465
  - request:
340
466
  method: put
341
467
  uri: https://app.datadoghq.com/api/v1/tags/hosts/chef.handler.datadog.test-failed?api_key=<API_KEY>&application_key=<APPLICATION_KEY>&source=chef
342
468
  body:
343
469
  encoding: UTF-8
344
- string: ! '{"tags":["env:hostile","role:highlander","tag:tag:the_one_and_only"]}'
470
+ string: '{"tags":["env:hostile","role:highlander","tag:tag:the_one_and_only"]}'
345
471
  headers:
472
+ Accept-Encoding:
473
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
346
474
  Accept:
347
- - ! '*/*'
475
+ - "*/*"
348
476
  User-Agent:
349
477
  - Ruby
350
478
  Content-Type:
@@ -359,19 +487,27 @@ http_interactions:
359
487
  Content-Type:
360
488
  - application/json
361
489
  Date:
362
- - Tue, 09 Sep 2014 12:15:14 GMT
490
+ - Tue, 26 Jan 2016 20:04:27 GMT
491
+ Dd-Pool:
492
+ - dogweb_sameorig
363
493
  Pragma:
364
494
  - no-cache
365
- Server:
366
- - gunicorn/19.1.0
495
+ Strict-Transport-Security:
496
+ - max-age=15724800;
497
+ X-Content-Type-Options:
498
+ - nosniff
499
+ X-Dd-Debug:
500
+ - QKcGho/VVHvOvAFq4WeaqBhqhL8eYL3K9CW+TToIP+o=
501
+ X-Frame-Options:
502
+ - SAMEORIGIN
367
503
  Content-Length:
368
504
  - '116'
369
505
  Connection:
370
506
  - keep-alive
371
507
  body:
372
- encoding: US-ASCII
373
- string: ! '{"host": "chef.handler.datadog.test-failed", "tags": ["tag:tag:the_one_and_only",
508
+ encoding: UTF-8
509
+ string: '{"host": "chef.handler.datadog.test-failed", "tags": ["tag:tag:the_one_and_only",
374
510
  "env:hostile", "role:highlander"]}'
375
511
  http_version:
376
- recorded_at: Tue, 09 Sep 2014 12:15:11 GMT
377
- recorded_with: VCR 2.9.2
512
+ recorded_at: Tue, 26 Jan 2016 20:04:28 GMT
513
+ recorded_with: VCR 3.0.1