chef-handler-datadog 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c54065be2df326d6779153aaecf8bfaa3e078d6
4
- data.tar.gz: 92eb9edaf6c4d5bcf82d0e4ee0f5bafcf9ffcf2c
3
+ metadata.gz: 79a5cd52c38bd2ea660a477778dc45fc24672bb6
4
+ data.tar.gz: e2fbe94dc27216f97ceaebab7021bb17f5c013dc
5
5
  SHA512:
6
- metadata.gz: d76b01f151c3d3e4e20784ab2713f952621b83f5097ea1298dfe4f69e8ba318315298c090bc300915570b56afad4f13981bfc193b37133977e8d97ce2379e62b
7
- data.tar.gz: e915c78a1b3689edb2691267b01288ee032494cce9d69143d7518c1aca8626ba8cced4ca7f954133e733e2ada8ede3326a85e7f9edf8dffb3fb408a06218be50
6
+ metadata.gz: 467c6a353533afc854f8e23bed60847d050a0f34f5d2ead72e692ca9e946868b5c2ef83d35fafe05e56993952cabd1b2da25b458015d62e0e615d22c287d2ff4
7
+ data.tar.gz: c42c73edaa05e589240b59c1971901fdc7d48297be5d06a3901e82a51ac23002692ead16bfca3f3be94125ccd6455968d9dd11f941fc180d6ecdc913341f21f6
@@ -1,6 +1,10 @@
1
1
  Changes
2
2
  =======
3
3
 
4
+ # 0.9.0 / 2016-03-22
5
+
6
+ * [FEATURE] Enable users to select tag prefix [#81][] [@mstepniowski][]
7
+
4
8
  # 0.8.0 / 2016-03-01
5
9
 
6
10
  * [FEATURE] Add success/failure metric [#75][] [@jhulten][]
@@ -84,13 +88,15 @@ And all other versions were prior to this. See git history for more.
84
88
  [#75]: https://github.com/DataDog/chef-handler-datadog/issues/75
85
89
  [#78]: https://github.com/DataDog/chef-handler-datadog/issues/78
86
90
  [#80]: https://github.com/DataDog/chef-handler-datadog/issues/80
91
+ [#81]: https://github.com/DataDog/chef-handler-datadog/issues/81
87
92
  [@alq]: https://github.com/alq
88
93
  [@bigbam505]: https://github.com/bigbam505
89
94
  [@datwiz]: https://github.com/datwiz
90
95
  [@dwradcliffe]: https://github.com/dwradcliffe
91
96
  [@jhulten]: https://github.com/jhulten
92
97
  [@miketheman]: https://github.com/miketheman
98
+ [@mstepniowski]: https://github.com/mstepniowski
93
99
  [@olivielpeau]: https://github.com/olivielpeau
94
100
  [@owen]: https://github.com/owen
95
101
  [@remh]: https://github.com/remh
96
- [@rlaveycal]: https://github.com/rlaveycal
102
+ [@rlaveycal]: https://github.com/rlaveycal
@@ -55,7 +55,8 @@ 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
+ .with_tag_prefix(config[:tag_prefix])
59
+ .with_retries(config[:tags_submission_retries])
59
60
 
60
61
  # Build the chef event information
61
62
  @event =
@@ -10,6 +10,7 @@ class DatadogChefTags
10
10
  @node = nil
11
11
  @run_status = nil
12
12
  @application_key = nil
13
+ @tag_prefix = 'tag:'
13
14
  @retries = 0
14
15
  @combined_host_tags = nil
15
16
  end
@@ -23,11 +24,6 @@ class DatadogChefTags
23
24
  self
24
25
  end
25
26
 
26
- # attribute accessor for combined array of tags
27
- #
28
- # @return [Array] the set of host tags based off the chef run
29
- attr_reader :combined_host_tags
30
-
31
27
  # set the chef run status used for the report
32
28
  #
33
29
  # @param run_status [Chef::RunStatus] current chef run status
@@ -38,13 +34,6 @@ class DatadogChefTags
38
34
  # Selects all [env, roles, tags] from the Node's object and reformats
39
35
  # them to `key:value` e.g. `role:database-master`.
40
36
  @node = run_status.node
41
- # generate the combined tags
42
- chef_env = node_env.split # converts a string into an array
43
- chef_roles = node_roles
44
- chef_tags = node_tags
45
-
46
- # Combine (union) all arrays. Removes duplicates if found.
47
- @combined_host_tags = chef_env | chef_roles | chef_tags
48
37
  self
49
38
  end
50
39
 
@@ -77,6 +66,15 @@ class DatadogChefTags
77
66
  self
78
67
  end
79
68
 
69
+ # set the prefix to be added to all Chef tags
70
+ #
71
+ # @param tag_prefix [String] prefix to be added to all Chef tags
72
+ # @return [DatadogChefTags] instance reference to self enabling method chaining
73
+ def with_tag_prefix(tag_prefix)
74
+ @tag_prefix = tag_prefix unless tag_prefix.nil?
75
+ self
76
+ end
77
+
80
78
  # set the number of retries when sending tags, when the host is not yet present
81
79
  # on Datadog
82
80
  #
@@ -89,11 +87,12 @@ class DatadogChefTags
89
87
 
90
88
  # send updated chef run generated tags to Datadog
91
89
  def send_update_to_datadog
90
+ tags = combined_host_tags
92
91
  retries = @retries
93
92
  begin
94
93
  loop do
95
94
  should_retry = false
96
- rc = @dog.update_tags(@hostname, combined_host_tags, 'chef')
95
+ rc = @dog.update_tags(@hostname, tags, 'chef')
97
96
  # See FIXME in DatadogChefEvents::emit_to_datadog about why I feel dirty repeating this code here
98
97
  if rc.length < 2
99
98
  Chef::Log.warn("Unexpected response from Datadog Tags API: #{rc}")
@@ -104,9 +103,9 @@ class DatadogChefTags
104
103
  retries -= 1
105
104
  should_retry = true
106
105
  elsif rc[0].to_i / 100 != 2
107
- Chef::Log.warn("Could not submit #{combined_host_tags} tags for #{@hostname} to Datadog: #{rc}")
106
+ Chef::Log.warn("Could not submit #{tags} tags for #{@hostname} to Datadog: #{rc}")
108
107
  else
109
- Chef::Log.debug("Successfully updated #{@hostname}'s tags to #{combined_host_tags.join(', ')}")
108
+ Chef::Log.debug("Successfully updated #{@hostname}'s tags to #{tags.join(', ')}")
110
109
  end
111
110
  end
112
111
  break unless should_retry
@@ -116,6 +115,14 @@ class DatadogChefTags
116
115
  end
117
116
  end
118
117
 
118
+ # return a combined array of tags that should be sent to Datadog
119
+ #
120
+ # @return [Array] the set of host tags based off the chef run
121
+ def combined_host_tags
122
+ # Combine (union) all arrays. Removes duplicates if found.
123
+ node_env.split | node_roles | node_tags
124
+ end
125
+
119
126
  private
120
127
 
121
128
  def node_roles
@@ -127,6 +134,7 @@ class DatadogChefTags
127
134
  end
128
135
 
129
136
  def node_tags
130
- @node.tags ? @node.tags.map! { |tag| 'tag:' + tag } : []
137
+ return [] unless @node.tags
138
+ @node.tags.map { |tag| "#{@tag_prefix}#{tag}" }
131
139
  end
132
140
  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.8.0'
5
+ VERSION = '0.9.0'
6
6
  end
@@ -28,6 +28,7 @@ describe Chef::Handler::Datadog, :vcr => :new_episodes do
28
28
  Chef::Handler::Datadog.new(
29
29
  'api_key' => API_KEY,
30
30
  'application_key' => APPLICATION_KEY,
31
+ 'tag_prefix' => 'tag',
31
32
  )
32
33
  end
33
34
  end
@@ -203,7 +204,7 @@ describe Chef::Handler::Datadog, :vcr => :new_episodes do
203
204
 
204
205
  describe 'when specified' do
205
206
  it 'sets the role and env and tags' do
206
- @node.normal.tags = ['the_one_and_only']
207
+ @node.normal.tags = ['the_one_and_only', 'datacenter:my-cloud']
207
208
  @handler.run_report_unsafe(@run_status)
208
209
 
209
210
  expect(a_request(:put, HOST_TAG_ENDPOINT + @node.name).with(
@@ -211,10 +212,40 @@ describe Chef::Handler::Datadog, :vcr => :new_episodes do
211
212
  'application_key' => @handler.config[:application_key],
212
213
  'source' => 'chef' },
213
214
  :body => hash_including(:tags => [
214
- 'env:hostile', 'role:highlander', 'tag:the_one_and_only'
215
+ 'env:hostile', 'role:highlander', 'tag:the_one_and_only', 'tag:datacenter:my-cloud'
215
216
  ]),
216
217
  )).to have_been_made.times(1)
217
218
  end
219
+
220
+ it 'allows for user-specified tag prefix' do
221
+ @node.normal.tags = ['the_one_and_only', 'datacenter:my-cloud']
222
+ @handler.config[:tag_prefix] = 'custom-prefix-'
223
+ @handler.run_report_unsafe(@run_status)
224
+
225
+ expect(a_request(:put, HOST_TAG_ENDPOINT + @node.name).with(
226
+ :query => { 'api_key' => @handler.config[:api_key],
227
+ 'application_key' => @handler.config[:application_key],
228
+ 'source' => 'chef' },
229
+ :body => hash_including(:tags => [
230
+ 'env:hostile', 'role:highlander', 'custom-prefix-the_one_and_only', 'custom-prefix-datacenter:my-cloud'
231
+ ]),
232
+ )).to have_been_made.times(1)
233
+ end
234
+
235
+ it 'allows for empty tag prefix' do
236
+ @node.normal.tags = ['the_one_and_only', 'datacenter:my-cloud']
237
+ @handler.config[:tag_prefix] = ''
238
+ @handler.run_report_unsafe(@run_status)
239
+
240
+ expect(a_request(:put, HOST_TAG_ENDPOINT + @node.name).with(
241
+ :query => { 'api_key' => @handler.config[:api_key],
242
+ 'application_key' => @handler.config[:application_key],
243
+ 'source' => 'chef' },
244
+ :body => hash_including(:tags => [
245
+ 'env:hostile', 'role:highlander', 'the_one_and_only', 'datacenter:my-cloud'
246
+ ]),
247
+ )).to have_been_made.times(1)
248
+ end
218
249
  end
219
250
 
220
251
  describe 'when unspecified' do
@@ -457,7 +488,7 @@ describe Chef::Handler::Datadog, :vcr => :new_episodes do
457
488
  )).to have_been_made.times(1)
458
489
  end
459
490
  end
460
- end
491
+ end
461
492
 
462
493
  # TODO: test failures:
463
494
  # @run_status.exception = Exception.new('Boy howdy!')
@@ -0,0 +1,251 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://app.datadoghq.com/api/v1/series?api_key=<API_KEY>
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"series":[{"metric":"chef.run.success","points":[[1458250870,1.0]],"type":"counter","host":"chef.handler.datadog.test-tags","device":null}]}'
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Content-Type:
17
+ - application/json
18
+ response:
19
+ status:
20
+ code: 202
21
+ message: Accepted
22
+ headers:
23
+ Content-Type:
24
+ - text/json
25
+ Date:
26
+ - Thu, 17 Mar 2016 21:41:05 GMT
27
+ Dd-Pool:
28
+ - propjoe
29
+ Strict-Transport-Security:
30
+ - max-age=15724800;
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Content-Length:
34
+ - '16'
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: UTF-8
39
+ string: '{"status": "ok"}'
40
+ http_version:
41
+ recorded_at: Thu, 17 Mar 2016 21:41:10 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":[[1458250870,0.0]],"type":"gauge","host":"chef.handler.datadog.test-tags","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
+ - Thu, 17 Mar 2016 21:41:05 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"}'
79
+ http_version:
80
+ recorded_at: Thu, 17 Mar 2016 21:41:10 GMT
81
+ - request:
82
+ method: post
83
+ uri: https://app.datadoghq.com/api/v1/series?api_key=<API_KEY>
84
+ body:
85
+ encoding: UTF-8
86
+ string: '{"series":[{"metric":"chef.resources.updated","points":[[1458250870,0.0]],"type":"gauge","host":"chef.handler.datadog.test-tags","device":null}]}'
87
+ headers:
88
+ Accept-Encoding:
89
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
90
+ Accept:
91
+ - "*/*"
92
+ User-Agent:
93
+ - Ruby
94
+ Content-Type:
95
+ - application/json
96
+ response:
97
+ status:
98
+ code: 202
99
+ message: Accepted
100
+ headers:
101
+ Content-Type:
102
+ - text/json
103
+ Date:
104
+ - Thu, 17 Mar 2016 21:41:05 GMT
105
+ Dd-Pool:
106
+ - propjoe
107
+ Strict-Transport-Security:
108
+ - max-age=15724800;
109
+ X-Content-Type-Options:
110
+ - nosniff
111
+ Content-Length:
112
+ - '16'
113
+ Connection:
114
+ - keep-alive
115
+ body:
116
+ encoding: UTF-8
117
+ string: '{"status": "ok"}'
118
+ http_version:
119
+ recorded_at: Thu, 17 Mar 2016 21:41:10 GMT
120
+ - request:
121
+ method: post
122
+ uri: https://app.datadoghq.com/api/v1/series?api_key=<API_KEY>
123
+ body:
124
+ encoding: UTF-8
125
+ string: '{"series":[{"metric":"chef.resources.elapsed_time","points":[[1458250870,5.0]],"type":"gauge","host":"chef.handler.datadog.test-tags","device":null}]}'
126
+ headers:
127
+ Accept-Encoding:
128
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
129
+ Accept:
130
+ - "*/*"
131
+ User-Agent:
132
+ - Ruby
133
+ Content-Type:
134
+ - application/json
135
+ response:
136
+ status:
137
+ code: 202
138
+ message: Accepted
139
+ headers:
140
+ Content-Type:
141
+ - text/json
142
+ Date:
143
+ - Thu, 17 Mar 2016 21:41:05 GMT
144
+ Dd-Pool:
145
+ - propjoe
146
+ Strict-Transport-Security:
147
+ - max-age=15724800;
148
+ X-Content-Type-Options:
149
+ - nosniff
150
+ Content-Length:
151
+ - '16'
152
+ Connection:
153
+ - keep-alive
154
+ body:
155
+ encoding: UTF-8
156
+ string: '{"status": "ok"}'
157
+ http_version:
158
+ recorded_at: Thu, 17 Mar 2016 21:41:10 GMT
159
+ - request:
160
+ method: post
161
+ uri: https://app.datadoghq.com/api/v1/events?api_key=<API_KEY>
162
+ body:
163
+ encoding: UTF-8
164
+ string: '{"msg_text":"Chef updated 0 resources out of 0 resources total.","date_happened":1458250870,"msg_title":"Chef
165
+ completed in 5 seconds on chef.handler.datadog.test-tags ","priority":"low","parent":null,"tags":null,"aggregation_key":"chef.handler.datadog.test-tags","alert_type":"success","event_type":"config_management.run","source_type_name":"chef","title":"Chef
166
+ completed in 5 seconds on chef.handler.datadog.test-tags ","text":"Chef updated
167
+ 0 resources out of 0 resources total.","host":"chef.handler.datadog.test-tags","device":null}'
168
+ headers:
169
+ Accept-Encoding:
170
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
171
+ Accept:
172
+ - "*/*"
173
+ User-Agent:
174
+ - Ruby
175
+ Content-Type:
176
+ - application/json
177
+ response:
178
+ status:
179
+ code: 202
180
+ message: Accepted
181
+ headers:
182
+ Content-Type:
183
+ - text/plain; charset=utf-8
184
+ Date:
185
+ - Thu, 17 Mar 2016 21:41:05 GMT
186
+ Dd-Pool:
187
+ - propjoe
188
+ Strict-Transport-Security:
189
+ - max-age=15724800;
190
+ X-Content-Type-Options:
191
+ - nosniff
192
+ Content-Length:
193
+ - '344'
194
+ Connection:
195
+ - keep-alive
196
+ body:
197
+ encoding: UTF-8
198
+ string: '{"status":"ok","event":{"id":455261105802551673,"title":"Chef completed
199
+ in 5 seconds on chef.handler.datadog.test-tags ","text":"Chef updated 0 resources
200
+ out of 0 resources total.","date_happened":1458250870,"handle":null,"priority":"low","related_event_id":null,"tags":null,"url":"https://app.datadoghq.com/event/event?id=455261105802551673"}}'
201
+ http_version:
202
+ recorded_at: Thu, 17 Mar 2016 21:41:10 GMT
203
+ - request:
204
+ method: put
205
+ uri: https://app.datadoghq.com/api/v1/tags/hosts/chef.handler.datadog.test-tags?api_key=<API_KEY>&application_key=<APPLICATION_KEY>&source=chef
206
+ body:
207
+ encoding: UTF-8
208
+ string: '{"tags":["env:hostile","role:highlander"]}'
209
+ headers:
210
+ Accept-Encoding:
211
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
212
+ Accept:
213
+ - "*/*"
214
+ User-Agent:
215
+ - Ruby
216
+ Content-Type:
217
+ - application/json
218
+ response:
219
+ status:
220
+ code: 201
221
+ message: Created
222
+ headers:
223
+ Cache-Control:
224
+ - no-cache
225
+ Content-Type:
226
+ - application/json
227
+ Date:
228
+ - Thu, 17 Mar 2016 21:41:05 GMT
229
+ Dd-Pool:
230
+ - dogweb_sameorig
231
+ Pragma:
232
+ - no-cache
233
+ Strict-Transport-Security:
234
+ - max-age=15724800;
235
+ X-Content-Type-Options:
236
+ - nosniff
237
+ X-Dd-Debug:
238
+ - Bj/SqNU1vbZGxNGffIRtmaWe7MKGSPoKHC3+ZhLAjqk=
239
+ X-Frame-Options:
240
+ - SAMEORIGIN
241
+ Content-Length:
242
+ - '86'
243
+ Connection:
244
+ - keep-alive
245
+ body:
246
+ encoding: UTF-8
247
+ string: '{"host": "chef.handler.datadog.test-tags", "tags": ["env:hostile",
248
+ "role:highlander"]}'
249
+ http_version:
250
+ recorded_at: Thu, 17 Mar 2016 21:41:10 GMT
251
+ recorded_with: VCR 3.0.1
@@ -0,0 +1,251 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://app.datadoghq.com/api/v1/series?api_key=<API_KEY>
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"series":[{"metric":"chef.run.success","points":[[1458250868,1.0]],"type":"counter","host":"chef.handler.datadog.test-tags","device":null}]}'
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Content-Type:
17
+ - application/json
18
+ response:
19
+ status:
20
+ code: 202
21
+ message: Accepted
22
+ headers:
23
+ Content-Type:
24
+ - text/json
25
+ Date:
26
+ - Thu, 17 Mar 2016 21:41:04 GMT
27
+ Dd-Pool:
28
+ - propjoe
29
+ Strict-Transport-Security:
30
+ - max-age=15724800;
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Content-Length:
34
+ - '16'
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: UTF-8
39
+ string: '{"status": "ok"}'
40
+ http_version:
41
+ recorded_at: Thu, 17 Mar 2016 21:41:08 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":[[1458250868,0.0]],"type":"gauge","host":"chef.handler.datadog.test-tags","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
+ - Thu, 17 Mar 2016 21:41:04 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"}'
79
+ http_version:
80
+ recorded_at: Thu, 17 Mar 2016 21:41:08 GMT
81
+ - request:
82
+ method: post
83
+ uri: https://app.datadoghq.com/api/v1/series?api_key=<API_KEY>
84
+ body:
85
+ encoding: UTF-8
86
+ string: '{"series":[{"metric":"chef.resources.updated","points":[[1458250868,0.0]],"type":"gauge","host":"chef.handler.datadog.test-tags","device":null}]}'
87
+ headers:
88
+ Accept-Encoding:
89
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
90
+ Accept:
91
+ - "*/*"
92
+ User-Agent:
93
+ - Ruby
94
+ Content-Type:
95
+ - application/json
96
+ response:
97
+ status:
98
+ code: 202
99
+ message: Accepted
100
+ headers:
101
+ Content-Type:
102
+ - text/json
103
+ Date:
104
+ - Thu, 17 Mar 2016 21:41:04 GMT
105
+ Dd-Pool:
106
+ - propjoe
107
+ Strict-Transport-Security:
108
+ - max-age=15724800;
109
+ X-Content-Type-Options:
110
+ - nosniff
111
+ Content-Length:
112
+ - '16'
113
+ Connection:
114
+ - keep-alive
115
+ body:
116
+ encoding: UTF-8
117
+ string: '{"status": "ok"}'
118
+ http_version:
119
+ recorded_at: Thu, 17 Mar 2016 21:41:08 GMT
120
+ - request:
121
+ method: post
122
+ uri: https://app.datadoghq.com/api/v1/series?api_key=<API_KEY>
123
+ body:
124
+ encoding: UTF-8
125
+ string: '{"series":[{"metric":"chef.resources.elapsed_time","points":[[1458250868,5.0]],"type":"gauge","host":"chef.handler.datadog.test-tags","device":null}]}'
126
+ headers:
127
+ Accept-Encoding:
128
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
129
+ Accept:
130
+ - "*/*"
131
+ User-Agent:
132
+ - Ruby
133
+ Content-Type:
134
+ - application/json
135
+ response:
136
+ status:
137
+ code: 202
138
+ message: Accepted
139
+ headers:
140
+ Content-Type:
141
+ - text/json
142
+ Date:
143
+ - Thu, 17 Mar 2016 21:41:04 GMT
144
+ Dd-Pool:
145
+ - propjoe
146
+ Strict-Transport-Security:
147
+ - max-age=15724800;
148
+ X-Content-Type-Options:
149
+ - nosniff
150
+ Content-Length:
151
+ - '16'
152
+ Connection:
153
+ - keep-alive
154
+ body:
155
+ encoding: UTF-8
156
+ string: '{"status": "ok"}'
157
+ http_version:
158
+ recorded_at: Thu, 17 Mar 2016 21:41:08 GMT
159
+ - request:
160
+ method: post
161
+ uri: https://app.datadoghq.com/api/v1/events?api_key=<API_KEY>
162
+ body:
163
+ encoding: UTF-8
164
+ string: '{"msg_text":"Chef updated 0 resources out of 0 resources total.","date_happened":1458250868,"msg_title":"Chef
165
+ completed in 5 seconds on chef.handler.datadog.test-tags ","priority":"low","parent":null,"tags":null,"aggregation_key":"chef.handler.datadog.test-tags","alert_type":"success","event_type":"config_management.run","source_type_name":"chef","title":"Chef
166
+ completed in 5 seconds on chef.handler.datadog.test-tags ","text":"Chef updated
167
+ 0 resources out of 0 resources total.","host":"chef.handler.datadog.test-tags","device":null}'
168
+ headers:
169
+ Accept-Encoding:
170
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
171
+ Accept:
172
+ - "*/*"
173
+ User-Agent:
174
+ - Ruby
175
+ Content-Type:
176
+ - application/json
177
+ response:
178
+ status:
179
+ code: 202
180
+ message: Accepted
181
+ headers:
182
+ Content-Type:
183
+ - text/plain; charset=utf-8
184
+ Date:
185
+ - Thu, 17 Mar 2016 21:41:04 GMT
186
+ Dd-Pool:
187
+ - propjoe
188
+ Strict-Transport-Security:
189
+ - max-age=15724800;
190
+ X-Content-Type-Options:
191
+ - nosniff
192
+ Content-Length:
193
+ - '344'
194
+ Connection:
195
+ - keep-alive
196
+ body:
197
+ encoding: UTF-8
198
+ string: '{"status":"ok","event":{"id":455261092784026415,"title":"Chef completed
199
+ in 5 seconds on chef.handler.datadog.test-tags ","text":"Chef updated 0 resources
200
+ out of 0 resources total.","date_happened":1458250868,"handle":null,"priority":"low","related_event_id":null,"tags":null,"url":"https://app.datadoghq.com/event/event?id=455261092784026415"}}'
201
+ http_version:
202
+ recorded_at: Thu, 17 Mar 2016 21:41:08 GMT
203
+ - request:
204
+ method: put
205
+ uri: https://app.datadoghq.com/api/v1/tags/hosts/chef.handler.datadog.test-tags?api_key=<API_KEY>&application_key=<APPLICATION_KEY>&source=chef
206
+ body:
207
+ encoding: UTF-8
208
+ string: '{"tags":["env:hostile","role:highlander"]}'
209
+ headers:
210
+ Accept-Encoding:
211
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
212
+ Accept:
213
+ - "*/*"
214
+ User-Agent:
215
+ - Ruby
216
+ Content-Type:
217
+ - application/json
218
+ response:
219
+ status:
220
+ code: 201
221
+ message: Created
222
+ headers:
223
+ Cache-Control:
224
+ - no-cache
225
+ Content-Type:
226
+ - application/json
227
+ Date:
228
+ - Thu, 17 Mar 2016 21:41:04 GMT
229
+ Dd-Pool:
230
+ - dogweb_sameorig
231
+ Pragma:
232
+ - no-cache
233
+ Strict-Transport-Security:
234
+ - max-age=15724800;
235
+ X-Content-Type-Options:
236
+ - nosniff
237
+ X-Dd-Debug:
238
+ - QYSb9ZUj91gVP/VyhgpNnm/M7M7fif9QER6YVwRajIA=
239
+ X-Frame-Options:
240
+ - SAMEORIGIN
241
+ Content-Length:
242
+ - '86'
243
+ Connection:
244
+ - keep-alive
245
+ body:
246
+ encoding: UTF-8
247
+ string: '{"host": "chef.handler.datadog.test-tags", "tags": ["env:hostile",
248
+ "role:highlander"]}'
249
+ http_version:
250
+ recorded_at: Thu, 17 Mar 2016 21:41:08 GMT
251
+ recorded_with: VCR 3.0.1
@@ -161,8 +161,8 @@ http_interactions:
161
161
  uri: https://app.datadoghq.com/api/v1/events?api_key=<API_KEY>
162
162
  body:
163
163
  encoding: UTF-8
164
- string: '{"msg_text":"Chef updated 0 resources out of 0 resources total.","date_happened":1453838676,"msg_title":"Chef
165
- completed in 5 seconds on chef.handler.datadog.test-tags ","priority":"low","parent":null,"tags":["env:hostile","role:highlander","tag:the_one_and_only"],"aggregation_key":"chef.handler.datadog.test-tags","alert_type":"success","event_type":"config_management.run","source_type_name":"chef","title":"Chef
164
+ string: '{"msg_text":"Chef updated 0 resources out of 0 resources total.","date_happened":1458601273,"msg_title":"Chef
165
+ completed in 5 seconds on chef.handler.datadog.test-tags ","priority":"low","parent":null,"tags":["env:hostile","role:highlander","tag:the_one_and_only","tag:datacenter:my-cloud"],"aggregation_key":"chef.handler.datadog.test-tags","alert_type":"success","event_type":"config_management.run","source_type_name":"chef","title":"Chef
166
166
  completed in 5 seconds on chef.handler.datadog.test-tags ","text":"Chef updated
167
167
  0 resources out of 0 resources total.","host":"chef.handler.datadog.test-tags","device":null}'
168
168
  headers:
@@ -190,22 +190,22 @@ http_interactions:
190
190
  X-Content-Type-Options:
191
191
  - nosniff
192
192
  Content-Length:
193
- - '396'
193
+ - '422'
194
194
  Connection:
195
195
  - keep-alive
196
196
  body:
197
197
  encoding: UTF-8
198
- string: '{"status":"ok","event":{"id":381236778694851193,"title":"Chef completed
198
+ string: '{"status":"ok","event":{"id":461139917332183580,"title":"Chef completed
199
199
  in 5 seconds on chef.handler.datadog.test-tags ","text":"Chef updated 0 resources
200
- out of 0 resources total.","date_happened":1453838676,"handle":null,"priority":"low","related_event_id":null,"tags":["env:hostile","role:highlander","tag:the_one_and_only"],"url":"https://app.datadoghq.com/event/event?id=381236778694851193"}}'
200
+ out of 0 resources total.","date_happened":1458601273,"handle":null,"priority":"low","related_event_id":null,"tags":["env:hostile","role:highlander","tag:the_one_and_only","tag:datacenter:my-cloud"],"url":"https://app.datadoghq.com/event/event?id=461139917332183580"}}'
201
201
  http_version:
202
- recorded_at: Tue, 26 Jan 2016 20:04:36 GMT
202
+ recorded_at: Mon, 21 Mar 2016 23:01:13 GMT
203
203
  - request:
204
204
  method: put
205
205
  uri: https://app.datadoghq.com/api/v1/tags/hosts/chef.handler.datadog.test-tags?api_key=<API_KEY>&application_key=<APPLICATION_KEY>&source=chef
206
206
  body:
207
207
  encoding: UTF-8
208
- string: '{"tags":["env:hostile","role:highlander","tag:the_one_and_only"]}'
208
+ string: '{"tags":["env:hostile","role:highlander","tag:the_one_and_only","tag:datacenter:my-cloud"]}'
209
209
  headers:
210
210
  Accept-Encoding:
211
211
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
@@ -239,13 +239,13 @@ http_interactions:
239
239
  X-Frame-Options:
240
240
  - SAMEORIGIN
241
241
  Content-Length:
242
- - '110'
242
+ - '137'
243
243
  Connection:
244
244
  - keep-alive
245
245
  body:
246
246
  encoding: UTF-8
247
- string: '{"host": "chef.handler.datadog.test-tags", "tags": ["env:hostile",
248
- "role:highlander", "tag:the_one_and_only"]}'
247
+ string: '{"host": "chef.handler.datadog.test-tags", "tags": ["tag:datacenter:my-cloud",
248
+ "env:hostile", "role:highlander", "tag:the_one_and_only"]}'
249
249
  http_version:
250
250
  recorded_at: Tue, 26 Jan 2016 20:04:36 GMT
251
251
  recorded_with: VCR 3.0.1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-handler-datadog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Fiedler
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-03-02 00:00:00.000000000 Z
13
+ date: 2016-03-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: dogapi
@@ -223,6 +223,8 @@ files:
223
223
  - spec/support/cassettes/Chef_Handler_Datadog/resources/failure_during_compile_phase/does_not_emit_metrics.yml
224
224
  - spec/support/cassettes/Chef_Handler_Datadog/resources/failure_during_compile_phase/only_emits_a_failure_metric.yml
225
225
  - spec/support/cassettes/Chef_Handler_Datadog/resources/failure_during_compile_phase/posts_an_event.yml
226
+ - spec/support/cassettes/Chef_Handler_Datadog/tags/when_specified/allows_for_empty_tag_prefix.yml
227
+ - spec/support/cassettes/Chef_Handler_Datadog/tags/when_specified/allows_for_user-specified_tag_prefix.yml
226
228
  - spec/support/cassettes/Chef_Handler_Datadog/tags/when_specified/sets_the_role_and_env_and_tags.yml
227
229
  - spec/support/cassettes/Chef_Handler_Datadog/tags/when_unspecified/sets_role_env_and_nothing_else.yml
228
230
  - spec/support/cassettes/Chef_Handler_Datadog/tags_submission_retries/when_not_specified/does_not_retry_after_a_failed_submission.yml
@@ -272,6 +274,8 @@ test_files:
272
274
  - spec/support/cassettes/Chef_Handler_Datadog/resources/failure_during_compile_phase/does_not_emit_metrics.yml
273
275
  - spec/support/cassettes/Chef_Handler_Datadog/resources/failure_during_compile_phase/only_emits_a_failure_metric.yml
274
276
  - spec/support/cassettes/Chef_Handler_Datadog/resources/failure_during_compile_phase/posts_an_event.yml
277
+ - spec/support/cassettes/Chef_Handler_Datadog/tags/when_specified/allows_for_empty_tag_prefix.yml
278
+ - spec/support/cassettes/Chef_Handler_Datadog/tags/when_specified/allows_for_user-specified_tag_prefix.yml
275
279
  - spec/support/cassettes/Chef_Handler_Datadog/tags/when_specified/sets_the_role_and_env_and_tags.yml
276
280
  - spec/support/cassettes/Chef_Handler_Datadog/tags/when_unspecified/sets_role_env_and_nothing_else.yml
277
281
  - spec/support/cassettes/Chef_Handler_Datadog/tags_submission_retries/when_not_specified/does_not_retry_after_a_failed_submission.yml