dogapi 1.8.1 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +2 -0
- data/.tailor +106 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +7 -0
- data/README.rdoc +4 -1
- data/Rakefile +31 -2
- data/lib/capistrano/datadog.rb +6 -10
- data/lib/dogapi/common.rb +1 -1
- data/lib/dogapi/event.rb +6 -6
- data/lib/dogapi/facade.rb +34 -45
- data/lib/dogapi/v1/alert.rb +1 -1
- data/lib/dogapi/v1/comment.rb +3 -3
- data/lib/dogapi/v1/dash.rb +1 -2
- data/lib/dogapi/v1/event.rb +1 -1
- data/lib/dogapi/v1/metric.rb +3 -3
- data/lib/dogapi/v1/user.rb +1 -1
- data/lib/dogapi/version.rb +1 -1
- data/spec/alerts_spec.rb +33 -0
- data/spec/common_spec.rb +16 -0
- data/spec/facade_spec.rb +122 -0
- data/spec/spec_helper.rb +28 -0
- data/spec/support/cassettes/Alerts/create/returns_HTTP_code_201.yml +90 -0
- data/spec/support/cassettes/Alerts/create/returns_a_valid_event_ID.yml +90 -0
- data/spec/support/cassettes/Alerts/create/returns_the_same_query_as_sent.yml +90 -0
- data/spec/support/cassettes/Facade/Client/emit_point_can_pass_nil_host.yml +32 -0
- data/spec/support/cassettes/Facade/Client/emit_point_passes_data.yml +32 -0
- data/spec/support/cassettes/Facade/Client/emit_point_uses_localhost_default.yml +32 -0
- data/spec/support/cassettes/Facade/Client/emits_point_with_localhost.yml +32 -0
- data/spec/support/cassettes/Facade/Events/emits_aggregate_events.yml +131 -0
- data/spec/support/cassettes/Facade/Events/emits_events_and_retrieves_them.yml +67 -0
- data/spec/support/cassettes/Facade/Events/emits_events_with_specified_priority.yml +67 -0
- data/spec/support/cassettes/Facade/Tags/adds_updates_and_detaches_tags.yml +352 -0
- data/tests/test_alerts.rb +3 -3
- data/tests/test_client.rb +0 -114
- data/tests/test_dashes.rb +3 -2
- metadata +38 -7
@@ -0,0 +1,352 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://app.datadoghq.com/api/v1/series?api_key=9775a026f1ca7d1c6c5af9d94d9595a4
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ! '{"series":[{"metric":"test.tag.metric","points":[[1377814456,1.0]],"type":"gauge","host":"test.tag.host","device":null}]}'
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 202
|
19
|
+
message: Accepted
|
20
|
+
headers:
|
21
|
+
Content-Type:
|
22
|
+
- text/json; charset=UTF-8
|
23
|
+
Date:
|
24
|
+
- Thu, 29 Aug 2013 22:14:17 GMT
|
25
|
+
Server:
|
26
|
+
- dogdispatcher/4.7.0
|
27
|
+
Content-Length:
|
28
|
+
- '15'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
body:
|
32
|
+
encoding: US-ASCII
|
33
|
+
string: ! '{"status":"ok"}'
|
34
|
+
http_version:
|
35
|
+
recorded_at: Thu, 29 Aug 2013 22:14:17 GMT
|
36
|
+
- request:
|
37
|
+
method: delete
|
38
|
+
uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=9775a026f1ca7d1c6c5af9d94d9595a4&application_key=87ce4a24b5553d2e482ea8a8500e71b8ad4554ff
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ''
|
42
|
+
headers:
|
43
|
+
Accept:
|
44
|
+
- ! '*/*'
|
45
|
+
User-Agent:
|
46
|
+
- Ruby
|
47
|
+
response:
|
48
|
+
status:
|
49
|
+
code: 204
|
50
|
+
message: No Content
|
51
|
+
headers:
|
52
|
+
Cache-Control:
|
53
|
+
- no-cache
|
54
|
+
Content-Length:
|
55
|
+
- '4'
|
56
|
+
Content-Type:
|
57
|
+
- application/json
|
58
|
+
Date:
|
59
|
+
- Thu, 29 Aug 2013 22:15:11 GMT
|
60
|
+
Pragma:
|
61
|
+
- no-cache
|
62
|
+
Server:
|
63
|
+
- gunicorn/0.17.4
|
64
|
+
Set-Cookie:
|
65
|
+
- user={"org":{"id":1499},"_type":"User","id":3658}; Path=/
|
66
|
+
X-Dd-Version:
|
67
|
+
- 31.161-301-21fcab4
|
68
|
+
Connection:
|
69
|
+
- keep-alive
|
70
|
+
body:
|
71
|
+
encoding: US-ASCII
|
72
|
+
string: ''
|
73
|
+
http_version:
|
74
|
+
recorded_at: Thu, 29 Aug 2013 22:15:11 GMT
|
75
|
+
- request:
|
76
|
+
method: get
|
77
|
+
uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=9775a026f1ca7d1c6c5af9d94d9595a4&application_key=87ce4a24b5553d2e482ea8a8500e71b8ad4554ff
|
78
|
+
body:
|
79
|
+
encoding: US-ASCII
|
80
|
+
string: ''
|
81
|
+
headers:
|
82
|
+
Accept:
|
83
|
+
- ! '*/*'
|
84
|
+
User-Agent:
|
85
|
+
- Ruby
|
86
|
+
response:
|
87
|
+
status:
|
88
|
+
code: 200
|
89
|
+
message: OK
|
90
|
+
headers:
|
91
|
+
Cache-Control:
|
92
|
+
- no-cache
|
93
|
+
Content-Type:
|
94
|
+
- application/json
|
95
|
+
Date:
|
96
|
+
- Thu, 29 Aug 2013 22:15:26 GMT
|
97
|
+
Pragma:
|
98
|
+
- no-cache
|
99
|
+
Server:
|
100
|
+
- gunicorn/0.17.4
|
101
|
+
Set-Cookie:
|
102
|
+
- user={"org":{"id":1499},"_type":"User","id":3658}; Path=/
|
103
|
+
X-Dd-Version:
|
104
|
+
- 31.161-301-21fcab4
|
105
|
+
Content-Length:
|
106
|
+
- '12'
|
107
|
+
Connection:
|
108
|
+
- keep-alive
|
109
|
+
body:
|
110
|
+
encoding: US-ASCII
|
111
|
+
string: ! '{"tags": []}'
|
112
|
+
http_version:
|
113
|
+
recorded_at: Thu, 29 Aug 2013 22:15:26 GMT
|
114
|
+
- request:
|
115
|
+
method: post
|
116
|
+
uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=9775a026f1ca7d1c6c5af9d94d9595a4&application_key=87ce4a24b5553d2e482ea8a8500e71b8ad4554ff
|
117
|
+
body:
|
118
|
+
encoding: UTF-8
|
119
|
+
string: ! '{"tags":["test.tag.1","test.tag.2"]}'
|
120
|
+
headers:
|
121
|
+
Accept:
|
122
|
+
- ! '*/*'
|
123
|
+
User-Agent:
|
124
|
+
- Ruby
|
125
|
+
Content-Type:
|
126
|
+
- application/json
|
127
|
+
response:
|
128
|
+
status:
|
129
|
+
code: 201
|
130
|
+
message: Created
|
131
|
+
headers:
|
132
|
+
Cache-Control:
|
133
|
+
- no-cache
|
134
|
+
Content-Type:
|
135
|
+
- application/json
|
136
|
+
Date:
|
137
|
+
- Thu, 29 Aug 2013 22:17:11 GMT
|
138
|
+
Pragma:
|
139
|
+
- no-cache
|
140
|
+
Server:
|
141
|
+
- gunicorn/0.17.4
|
142
|
+
Set-Cookie:
|
143
|
+
- user={"org":{"id":1499},"_type":"User","id":3658}; Path=/
|
144
|
+
X-Dd-Version:
|
145
|
+
- 31.161-301-21fcab4
|
146
|
+
Content-Length:
|
147
|
+
- '63'
|
148
|
+
Connection:
|
149
|
+
- keep-alive
|
150
|
+
body:
|
151
|
+
encoding: US-ASCII
|
152
|
+
string: ! '{"host": "test.tag.host", "tags": ["test.tag.2", "test.tag.1"]}'
|
153
|
+
http_version:
|
154
|
+
recorded_at: Thu, 29 Aug 2013 22:17:11 GMT
|
155
|
+
- request:
|
156
|
+
method: get
|
157
|
+
uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=9775a026f1ca7d1c6c5af9d94d9595a4&application_key=87ce4a24b5553d2e482ea8a8500e71b8ad4554ff
|
158
|
+
body:
|
159
|
+
encoding: US-ASCII
|
160
|
+
string: ''
|
161
|
+
headers:
|
162
|
+
Accept:
|
163
|
+
- ! '*/*'
|
164
|
+
User-Agent:
|
165
|
+
- Ruby
|
166
|
+
response:
|
167
|
+
status:
|
168
|
+
code: 200
|
169
|
+
message: OK
|
170
|
+
headers:
|
171
|
+
Cache-Control:
|
172
|
+
- no-cache
|
173
|
+
Content-Type:
|
174
|
+
- application/json
|
175
|
+
Date:
|
176
|
+
- Thu, 29 Aug 2013 22:17:11 GMT
|
177
|
+
Pragma:
|
178
|
+
- no-cache
|
179
|
+
Server:
|
180
|
+
- gunicorn/0.17.4
|
181
|
+
Set-Cookie:
|
182
|
+
- user={"org":{"id":1499},"_type":"User","id":3658}; Path=/
|
183
|
+
X-Dd-Version:
|
184
|
+
- 31.161-301-21fcab4
|
185
|
+
Content-Length:
|
186
|
+
- '38'
|
187
|
+
Connection:
|
188
|
+
- keep-alive
|
189
|
+
body:
|
190
|
+
encoding: US-ASCII
|
191
|
+
string: ! '{"tags": ["test.tag.2", "test.tag.1"]}'
|
192
|
+
http_version:
|
193
|
+
recorded_at: Thu, 29 Aug 2013 22:17:11 GMT
|
194
|
+
- request:
|
195
|
+
method: post
|
196
|
+
uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=9775a026f1ca7d1c6c5af9d94d9595a4&application_key=87ce4a24b5553d2e482ea8a8500e71b8ad4554ff
|
197
|
+
body:
|
198
|
+
encoding: UTF-8
|
199
|
+
string: ! '{"tags":["test.tag.3"]}'
|
200
|
+
headers:
|
201
|
+
Accept:
|
202
|
+
- ! '*/*'
|
203
|
+
User-Agent:
|
204
|
+
- Ruby
|
205
|
+
Content-Type:
|
206
|
+
- application/json
|
207
|
+
response:
|
208
|
+
status:
|
209
|
+
code: 201
|
210
|
+
message: Created
|
211
|
+
headers:
|
212
|
+
Cache-Control:
|
213
|
+
- no-cache
|
214
|
+
Content-Type:
|
215
|
+
- application/json
|
216
|
+
Date:
|
217
|
+
- Thu, 29 Aug 2013 22:22:15 GMT
|
218
|
+
Pragma:
|
219
|
+
- no-cache
|
220
|
+
Server:
|
221
|
+
- gunicorn/0.17.4
|
222
|
+
Set-Cookie:
|
223
|
+
- user={"org":{"id":1499},"_type":"User","id":3658}; Path=/
|
224
|
+
X-Dd-Version:
|
225
|
+
- 31.161-301-21fcab4
|
226
|
+
Content-Length:
|
227
|
+
- '77'
|
228
|
+
Connection:
|
229
|
+
- keep-alive
|
230
|
+
body:
|
231
|
+
encoding: US-ASCII
|
232
|
+
string: ! '{"host": "test.tag.host", "tags": ["test.tag.2", "test.tag.3", "test.tag.1"]}'
|
233
|
+
http_version:
|
234
|
+
recorded_at: Thu, 29 Aug 2013 22:22:15 GMT
|
235
|
+
- request:
|
236
|
+
method: get
|
237
|
+
uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=9775a026f1ca7d1c6c5af9d94d9595a4&application_key=87ce4a24b5553d2e482ea8a8500e71b8ad4554ff
|
238
|
+
body:
|
239
|
+
encoding: US-ASCII
|
240
|
+
string: ''
|
241
|
+
headers:
|
242
|
+
Accept:
|
243
|
+
- ! '*/*'
|
244
|
+
User-Agent:
|
245
|
+
- Ruby
|
246
|
+
response:
|
247
|
+
status:
|
248
|
+
code: 200
|
249
|
+
message: OK
|
250
|
+
headers:
|
251
|
+
Cache-Control:
|
252
|
+
- no-cache
|
253
|
+
Content-Type:
|
254
|
+
- application/json
|
255
|
+
Date:
|
256
|
+
- Thu, 29 Aug 2013 22:22:16 GMT
|
257
|
+
Pragma:
|
258
|
+
- no-cache
|
259
|
+
Server:
|
260
|
+
- gunicorn/0.17.4
|
261
|
+
Set-Cookie:
|
262
|
+
- user={"org":{"id":1499},"_type":"User","id":3658}; Path=/
|
263
|
+
X-Dd-Version:
|
264
|
+
- 31.161-301-21fcab4
|
265
|
+
Content-Length:
|
266
|
+
- '52'
|
267
|
+
Connection:
|
268
|
+
- keep-alive
|
269
|
+
body:
|
270
|
+
encoding: US-ASCII
|
271
|
+
string: ! '{"tags": ["test.tag.2", "test.tag.3", "test.tag.1"]}'
|
272
|
+
http_version:
|
273
|
+
recorded_at: Thu, 29 Aug 2013 22:22:16 GMT
|
274
|
+
- request:
|
275
|
+
method: delete
|
276
|
+
uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=9775a026f1ca7d1c6c5af9d94d9595a4&application_key=87ce4a24b5553d2e482ea8a8500e71b8ad4554ff
|
277
|
+
body:
|
278
|
+
encoding: US-ASCII
|
279
|
+
string: ''
|
280
|
+
headers:
|
281
|
+
Accept:
|
282
|
+
- ! '*/*'
|
283
|
+
User-Agent:
|
284
|
+
- Ruby
|
285
|
+
response:
|
286
|
+
status:
|
287
|
+
code: 204
|
288
|
+
message: No Content
|
289
|
+
headers:
|
290
|
+
Cache-Control:
|
291
|
+
- no-cache
|
292
|
+
Content-Length:
|
293
|
+
- '4'
|
294
|
+
Content-Type:
|
295
|
+
- application/json
|
296
|
+
Date:
|
297
|
+
- Thu, 29 Aug 2013 22:23:47 GMT
|
298
|
+
Pragma:
|
299
|
+
- no-cache
|
300
|
+
Server:
|
301
|
+
- gunicorn/0.17.4
|
302
|
+
Set-Cookie:
|
303
|
+
- user={"org":{"id":1499},"_type":"User","id":3658}; Path=/
|
304
|
+
X-Dd-Version:
|
305
|
+
- 31.161-301-21fcab4
|
306
|
+
Connection:
|
307
|
+
- keep-alive
|
308
|
+
body:
|
309
|
+
encoding: US-ASCII
|
310
|
+
string: ''
|
311
|
+
http_version:
|
312
|
+
recorded_at: Thu, 29 Aug 2013 22:23:47 GMT
|
313
|
+
- request:
|
314
|
+
method: get
|
315
|
+
uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=9775a026f1ca7d1c6c5af9d94d9595a4&application_key=87ce4a24b5553d2e482ea8a8500e71b8ad4554ff
|
316
|
+
body:
|
317
|
+
encoding: US-ASCII
|
318
|
+
string: ''
|
319
|
+
headers:
|
320
|
+
Accept:
|
321
|
+
- ! '*/*'
|
322
|
+
User-Agent:
|
323
|
+
- Ruby
|
324
|
+
response:
|
325
|
+
status:
|
326
|
+
code: 200
|
327
|
+
message: OK
|
328
|
+
headers:
|
329
|
+
Cache-Control:
|
330
|
+
- no-cache
|
331
|
+
Content-Type:
|
332
|
+
- application/json
|
333
|
+
Date:
|
334
|
+
- Thu, 29 Aug 2013 22:23:47 GMT
|
335
|
+
Pragma:
|
336
|
+
- no-cache
|
337
|
+
Server:
|
338
|
+
- gunicorn/0.17.4
|
339
|
+
Set-Cookie:
|
340
|
+
- user={"org":{"id":1499},"_type":"User","id":3658}; Path=/
|
341
|
+
X-Dd-Version:
|
342
|
+
- 31.161-301-21fcab4
|
343
|
+
Content-Length:
|
344
|
+
- '12'
|
345
|
+
Connection:
|
346
|
+
- keep-alive
|
347
|
+
body:
|
348
|
+
encoding: US-ASCII
|
349
|
+
string: ! '{"tags": []}'
|
350
|
+
http_version:
|
351
|
+
recorded_at: Thu, 29 Aug 2013 22:23:48 GMT
|
352
|
+
recorded_with: VCR 2.5.0
|
data/tests/test_alerts.rb
CHANGED
@@ -8,7 +8,7 @@ class TestAlerts < Test::Unit::TestCase
|
|
8
8
|
def test_alerts
|
9
9
|
dog = Dogapi::Client.new(@api_key, @app_key)
|
10
10
|
|
11
|
-
query = '
|
11
|
+
query = 'avg(last_1h):sum:system.net.bytes_rcvd{host:host0} > 100'
|
12
12
|
|
13
13
|
alert_id = dog.alert(query)[1]['id']
|
14
14
|
status, alert = dog.get_alert(alert_id)
|
@@ -22,8 +22,8 @@ class TestAlerts < Test::Unit::TestCase
|
|
22
22
|
|
23
23
|
dog.delete_alert(alert_id)
|
24
24
|
|
25
|
-
query1 = '
|
26
|
-
query2 = '
|
25
|
+
query1 = 'avg(last_1h):sum:system.net.bytes_rcvd{host:host0} > 100'
|
26
|
+
query2 = 'avg(last_1h):sum:system.net.bytes_rcvd{host:host0} > 200'
|
27
27
|
|
28
28
|
alert_id1 = dog.alert(query1)[1]['id']
|
29
29
|
alert_id2 = dog.alert(query2)[1]['id']
|
data/tests/test_client.rb
CHANGED
@@ -12,120 +12,6 @@ class TestClient < Test::Unit::TestCase
|
|
12
12
|
assert Dogapi.find_localhost == %x[hostname -f].strip
|
13
13
|
end
|
14
14
|
|
15
|
-
def test_tags
|
16
|
-
hostname = "test.tag.host.#{job_number}"
|
17
|
-
dog = Dogapi::Client.new(@api_key, @app_key)
|
18
|
-
|
19
|
-
# post a metric to make sure the test host context exists
|
20
|
-
dog.emit_point('test.tag.metric', 1, :host => hostname)
|
21
|
-
|
22
|
-
# Disable this call until we fix the timeouts
|
23
|
-
# dog.all_tags()
|
24
|
-
|
25
|
-
sleep 3
|
26
|
-
|
27
|
-
dog.detach_tags(hostname)
|
28
|
-
code, resp = dog.host_tags(hostname)
|
29
|
-
assert resp["tags"].size == 0
|
30
|
-
|
31
|
-
dog.add_tags(hostname, ['test.tag.1', 'test.tag.2'])
|
32
|
-
code, resp = dog.host_tags(hostname)
|
33
|
-
new_tags = resp["tags"]
|
34
|
-
assert new_tags.size == 2
|
35
|
-
assert new_tags.include?('test.tag.1')
|
36
|
-
assert new_tags.include?('test.tag.2')
|
37
|
-
|
38
|
-
dog.add_tags(hostname, ['test.tag.3'])
|
39
|
-
code, resp = dog.host_tags(hostname)
|
40
|
-
new_tags = resp["tags"]
|
41
|
-
assert new_tags.size == 3
|
42
|
-
assert new_tags.include?('test.tag.1')
|
43
|
-
assert new_tags.include?('test.tag.2')
|
44
|
-
assert new_tags.include?('test.tag.3')
|
45
|
-
|
46
|
-
dog.update_tags(hostname, ['test.tag.4'])
|
47
|
-
code, resp = dog.host_tags(hostname)
|
48
|
-
new_tags = resp["tags"]
|
49
|
-
assert new_tags.size == 1
|
50
|
-
assert new_tags.include?('test.tag.4')
|
51
|
-
|
52
|
-
dog.detach_tags(hostname)
|
53
|
-
code, resp = dog.host_tags(hostname)
|
54
|
-
assert resp["tags"].size == 0
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_events
|
58
|
-
now = Time.now()
|
59
|
-
|
60
|
-
# Tag the events with the build number, because Travis parallel testing
|
61
|
-
# can cause problems with the event stream
|
62
|
-
tags = ["test-run:#{job_number}"]
|
63
|
-
|
64
|
-
now_ts = now
|
65
|
-
now_title = 'dogapi-rb end test title ' + now_ts.to_i.to_s
|
66
|
-
now_message = 'test message ' + now_ts.to_i.to_s
|
67
|
-
|
68
|
-
before_ts = (now - 5*60)
|
69
|
-
before_title = 'dogapi-rb start test title ' + before_ts.to_i.to_s
|
70
|
-
before_message = 'test message ' + before_ts.to_i.to_s
|
71
|
-
|
72
|
-
dog = Dogapi::Client.new(@api_key, @app_key)
|
73
|
-
dog_r = Dogapi::Client.new(@api_key)
|
74
|
-
|
75
|
-
e1 = Dogapi::Event.new(now_message, :msg_title => now_title,
|
76
|
-
:date_happened => now_ts, :tags => tags)
|
77
|
-
e2 = Dogapi::Event.new(before_message, :msg_title => before_title,
|
78
|
-
:date_happened => before_ts, :tags => tags)
|
79
|
-
|
80
|
-
code, resp = dog_r.emit_event(e1)
|
81
|
-
now_event_id = resp["event"]["id"]
|
82
|
-
code, resp = dog_r.emit_event(e2)
|
83
|
-
before_event_id = resp["event"]["id"]
|
84
|
-
|
85
|
-
sleep 5
|
86
|
-
|
87
|
-
code, resp = dog.stream(before_ts, now_ts + 1, :tags => tags)
|
88
|
-
stream = resp["events"]
|
89
|
-
|
90
|
-
code, resp = dog.get_event(now_event_id)
|
91
|
-
assert !resp['event'].nil?
|
92
|
-
now_event = resp['event']
|
93
|
-
|
94
|
-
code, resp = dog.get_event(before_event_id)
|
95
|
-
assert !resp['event'].nil?
|
96
|
-
before_event = resp['event']
|
97
|
-
|
98
|
-
assert now_event['text'] == now_message
|
99
|
-
assert before_event['text'] == before_message
|
100
|
-
|
101
|
-
# Testing priorities
|
102
|
-
code, resp = dog_r.emit_event(Dogapi::Event.new(now_message, :msg_title => now_title, :date_happened => now_ts, :priority => "low"))
|
103
|
-
low_event_id = resp["event"]["id"]
|
104
|
-
|
105
|
-
sleep 5
|
106
|
-
|
107
|
-
code, resp = dog.get_event(low_event_id)
|
108
|
-
assert !resp['event'].nil?
|
109
|
-
low_event = resp['event']
|
110
|
-
assert low_event['priority'] == "low"
|
111
|
-
|
112
|
-
# Testing aggregates
|
113
|
-
agg_ts = Time.now()
|
114
|
-
code, resp = dog_r.emit_event(Dogapi::Event.new("Testing Aggregation (first)", :aggregation_key => now_ts.to_i))
|
115
|
-
first = resp["event"]["id"]
|
116
|
-
code, resp = dog_r.emit_event(Dogapi::Event.new("Testing Aggregation (second)", :aggregation_key => now_ts.to_i))
|
117
|
-
second = resp["event"]["id"]
|
118
|
-
|
119
|
-
sleep 3
|
120
|
-
|
121
|
-
code, resp = dog.get_event(first)
|
122
|
-
agg1 = resp["event"]
|
123
|
-
code, resp = dog.get_event(second)
|
124
|
-
agg2 = resp["event"]
|
125
|
-
|
126
|
-
# FIXME Need to export is_aggregate/children fields
|
127
|
-
end
|
128
|
-
|
129
15
|
def test_metrics
|
130
16
|
# FIXME: actually verify this once there's a way to look at metrics through the api
|
131
17
|
dog = Dogapi::Client.new(@api_key, @app_key)
|