hawkular-client 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +17 -0
  3. data/.rubocop.yml +14 -0
  4. data/.travis.yml +5 -0
  5. data/CHANGES.rdoc +6 -0
  6. data/Gemfile +1 -1
  7. data/README.rdoc +2 -1
  8. data/Rakefile +6 -3
  9. data/hawkularclient.gemspec +17 -11
  10. data/lib/hawkularclient.rb +91 -98
  11. data/lib/metrics/metric_api.rb +83 -66
  12. data/lib/metrics/tenant_api.rb +3 -4
  13. data/lib/metrics/types.rb +9 -11
  14. data/lib/metrics/version.rb +1 -1
  15. data/spec/{endpoint.yml.example → endpoint.yml} +0 -0
  16. data/spec/integration/metric_spec.rb +223 -131
  17. data/spec/spec_helper.rb +14 -10
  18. data/spec/unit/client_spec.rb +24 -19
  19. data/spec/vcr/vcr_setup.rb +16 -0
  20. data/spec/vcr_cassettes/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +87 -0
  21. data/spec/vcr_cassettes/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +87 -0
  22. data/spec/vcr_cassettes/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +126 -0
  23. data/spec/vcr_cassettes/Availability_metrics/Should_update_tags_for_Availability_definition.yml +210 -0
  24. data/spec/vcr_cassettes/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +87 -0
  25. data/spec/vcr_cassettes/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +87 -0
  26. data/spec/vcr_cassettes/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +249 -0
  27. data/spec/vcr_cassettes/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +126 -0
  28. data/spec/vcr_cassettes/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +87 -0
  29. data/spec/vcr_cassettes/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +87 -0
  30. data/spec/vcr_cassettes/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +249 -0
  31. data/spec/vcr_cassettes/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +126 -0
  32. data/spec/vcr_cassettes/Gauge_metrics/Should_return_periods.yml +85 -0
  33. data/spec/vcr_cassettes/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +210 -0
  34. data/spec/vcr_cassettes/Mixed_metrics/Should_send_mixed_metric_request.yml +284 -0
  35. data/spec/vcr_cassettes/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +249 -0
  36. data/spec/vcr_cassettes/Simple/Should_be_Cool.yml +208 -0
  37. data/spec/vcr_cassettes/Tenants/Should_create_and_return_tenant.yml +79 -0
  38. metadata +111 -25
@@ -0,0 +1,85 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://localhost:8080/hawkular/metrics/gauges/<%= id %>/data
6
+ body:
7
+ encoding: UTF-8
8
+ string: '[{"value":1,"timestamp":<%= minus30 %>},{"value":2,"timestamp":<%= minus20 %>},{"value":3,"timestamp":<%= start %>}]'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Hawkular-Tenant:
15
+ - vcr-test-tenant-123
16
+ Tenantid:
17
+ - vcr-test-tenant-123
18
+ Content-Type:
19
+ - application/json
20
+ Content-Length:
21
+ - '115'
22
+ User-Agent:
23
+ - Ruby
24
+ response:
25
+ status:
26
+ code: 200
27
+ message: OK
28
+ headers:
29
+ Connection:
30
+ - keep-alive
31
+ X-Powered-By:
32
+ - Undertow/1
33
+ Server:
34
+ - WildFly/9
35
+ Content-Length:
36
+ - '0'
37
+ Date:
38
+ - Fri, 30 Oct 2015 12:01:29 GMT
39
+ body:
40
+ encoding: UTF-8
41
+ string: ''
42
+ http_version:
43
+ recorded_at: Fri, 30 Oct 2015 12:01:29 GMT
44
+ - request:
45
+ method: get
46
+ uri: http://localhost:8080/hawkular/metrics/gauges/<%= id %>/periods?op=lte&start=<%= before4h %>&threshold=4
47
+ body:
48
+ encoding: US-ASCII
49
+ string: ''
50
+ headers:
51
+ Accept:
52
+ - application/json
53
+ Accept-Encoding:
54
+ - gzip, deflate
55
+ Hawkular-Tenant:
56
+ - vcr-test-tenant-123
57
+ Tenantid:
58
+ - vcr-test-tenant-123
59
+ Content-Type:
60
+ - application/json
61
+ User-Agent:
62
+ - Ruby
63
+ response:
64
+ status:
65
+ code: 200
66
+ message: OK
67
+ headers:
68
+ Connection:
69
+ - keep-alive
70
+ X-Powered-By:
71
+ - Undertow/1
72
+ Server:
73
+ - WildFly/9
74
+ Content-Type:
75
+ - application/json
76
+ Content-Length:
77
+ - '31'
78
+ Date:
79
+ - Fri, 30 Oct 2015 12:01:29 GMT
80
+ body:
81
+ encoding: UTF-8
82
+ string: '[[<%= minus30 %>,<%= start %>]]'
83
+ http_version:
84
+ recorded_at: Fri, 30 Oct 2015 12:01:29 GMT
85
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,210 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://localhost:8080/hawkular/metrics/gauges
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"id":"<%= id %>","tags":{"myTag":"<%= id %>"}}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Hawkular-Tenant:
15
+ - vcr-test-tenant-123
16
+ Tenantid:
17
+ - vcr-test-tenant-123
18
+ Content-Type:
19
+ - application/json
20
+ Content-Length:
21
+ - '101'
22
+ User-Agent:
23
+ - Ruby
24
+ response:
25
+ status:
26
+ code: 201
27
+ message: Created
28
+ headers:
29
+ Connection:
30
+ - keep-alive
31
+ X-Powered-By:
32
+ - Undertow/1
33
+ Server:
34
+ - WildFly/9
35
+ Location:
36
+ - http://localhost:8080/hawkular/metrics/gauges/<%= id %>
37
+ Content-Length:
38
+ - '0'
39
+ Date:
40
+ - Fri, 30 Oct 2015 12:01:29 GMT
41
+ body:
42
+ encoding: UTF-8
43
+ string: ''
44
+ http_version:
45
+ recorded_at: Fri, 30 Oct 2015 12:01:29 GMT
46
+ - request:
47
+ method: get
48
+ uri: http://localhost:8080/hawkular/metrics/gauges/<%= id %>
49
+ body:
50
+ encoding: US-ASCII
51
+ string: ''
52
+ headers:
53
+ Accept:
54
+ - application/json
55
+ Accept-Encoding:
56
+ - gzip, deflate
57
+ Hawkular-Tenant:
58
+ - vcr-test-tenant-123
59
+ Tenantid:
60
+ - vcr-test-tenant-123
61
+ Content-Type:
62
+ - application/json
63
+ User-Agent:
64
+ - Ruby
65
+ response:
66
+ status:
67
+ code: 200
68
+ message: OK
69
+ headers:
70
+ Connection:
71
+ - keep-alive
72
+ X-Powered-By:
73
+ - Undertow/1
74
+ Server:
75
+ - WildFly/9
76
+ Content-Type:
77
+ - application/json
78
+ Content-Length:
79
+ - '149'
80
+ Date:
81
+ - Fri, 30 Oct 2015 12:01:29 GMT
82
+ body:
83
+ encoding: UTF-8
84
+ string: '{"id":"<%= id %>","tags":{"myTag":"<%= id %>"},"type":"gauge","tenantId":"vcr-test-tenant-123"}'
85
+ http_version:
86
+ recorded_at: Fri, 30 Oct 2015 12:01:29 GMT
87
+ - request:
88
+ method: put
89
+ uri: http://localhost:8080/hawkular/metrics/gauges/<%= id %>/tags
90
+ body:
91
+ encoding: UTF-8
92
+ string: '{"newTag":"newValue"}'
93
+ headers:
94
+ Accept:
95
+ - application/json
96
+ Accept-Encoding:
97
+ - gzip, deflate
98
+ Hawkular-Tenant:
99
+ - vcr-test-tenant-123
100
+ Tenantid:
101
+ - vcr-test-tenant-123
102
+ Content-Type:
103
+ - application/json
104
+ Content-Length:
105
+ - '21'
106
+ User-Agent:
107
+ - Ruby
108
+ response:
109
+ status:
110
+ code: 200
111
+ message: OK
112
+ headers:
113
+ Connection:
114
+ - keep-alive
115
+ X-Powered-By:
116
+ - Undertow/1
117
+ Server:
118
+ - WildFly/9
119
+ Content-Length:
120
+ - '0'
121
+ Date:
122
+ - Fri, 30 Oct 2015 12:01:29 GMT
123
+ body:
124
+ encoding: UTF-8
125
+ string: ''
126
+ http_version:
127
+ recorded_at: Fri, 30 Oct 2015 12:01:29 GMT
128
+ - request:
129
+ method: get
130
+ uri: http://localhost:8080/hawkular/metrics/gauges/<%= id %>
131
+ body:
132
+ encoding: US-ASCII
133
+ string: ''
134
+ headers:
135
+ Accept:
136
+ - application/json
137
+ Accept-Encoding:
138
+ - gzip, deflate
139
+ Hawkular-Tenant:
140
+ - vcr-test-tenant-123
141
+ Tenantid:
142
+ - vcr-test-tenant-123
143
+ Content-Type:
144
+ - application/json
145
+ User-Agent:
146
+ - Ruby
147
+ response:
148
+ status:
149
+ code: 200
150
+ message: OK
151
+ headers:
152
+ Connection:
153
+ - keep-alive
154
+ X-Powered-By:
155
+ - Undertow/1
156
+ Server:
157
+ - WildFly/9
158
+ Content-Type:
159
+ - application/json
160
+ Content-Length:
161
+ - '169'
162
+ Date:
163
+ - Fri, 30 Oct 2015 12:01:29 GMT
164
+ body:
165
+ encoding: UTF-8
166
+ string: '{"id":"<%= id %>","tags":{"myTag":"<%= id %>","newTag":"newValue"},"type":"gauge","tenantId":"vcr-test-tenant-123"}'
167
+ http_version:
168
+ recorded_at: Fri, 30 Oct 2015 12:01:29 GMT
169
+ - request:
170
+ method: get
171
+ uri: http://localhost:8080/hawkular/metrics/metrics/?tags=myTag:<%= id %>&type=gauge
172
+ body:
173
+ encoding: US-ASCII
174
+ string: ''
175
+ headers:
176
+ Accept:
177
+ - application/json
178
+ Accept-Encoding:
179
+ - gzip, deflate
180
+ Hawkular-Tenant:
181
+ - vcr-test-tenant-123
182
+ Tenantid:
183
+ - vcr-test-tenant-123
184
+ Content-Type:
185
+ - application/json
186
+ User-Agent:
187
+ - Ruby
188
+ response:
189
+ status:
190
+ code: 200
191
+ message: OK
192
+ headers:
193
+ Connection:
194
+ - keep-alive
195
+ X-Powered-By:
196
+ - Undertow/1
197
+ Server:
198
+ - WildFly/9
199
+ Content-Type:
200
+ - application/json
201
+ Content-Length:
202
+ - '171'
203
+ Date:
204
+ - Fri, 30 Oct 2015 12:01:29 GMT
205
+ body:
206
+ encoding: UTF-8
207
+ string: '[{"id":"<%= id %>","tags":{"myTag":"<%= id %>","newTag":"newValue"},"type":"gauge","tenantId":"vcr-test-tenant-123"}]'
208
+ http_version:
209
+ recorded_at: Fri, 30 Oct 2015 12:01:29 GMT
210
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,284 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:8080/hawkular/metrics/counters/<%= id %>/data/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Hawkular-Tenant:
15
+ - vcr-test-tenant-123
16
+ Tenantid:
17
+ - vcr-test-tenant-123
18
+ Content-Type:
19
+ - application/json
20
+ User-Agent:
21
+ - Ruby
22
+ response:
23
+ status:
24
+ code: 204
25
+ message: No Content
26
+ headers:
27
+ Connection:
28
+ - keep-alive
29
+ X-Powered-By:
30
+ - Undertow/1
31
+ Server:
32
+ - WildFly/9
33
+ Content-Length:
34
+ - '0'
35
+ Date:
36
+ - Fri, 30 Oct 2015 17:39:17 GMT
37
+ body:
38
+ encoding: UTF-8
39
+ string: ''
40
+ http_version:
41
+ recorded_at: Fri, 30 Oct 2015 17:39:17 GMT
42
+ - request:
43
+ method: get
44
+ uri: http://localhost:8080/hawkular/metrics/gauges/<%= id %>/data/
45
+ body:
46
+ encoding: US-ASCII
47
+ string: ''
48
+ headers:
49
+ Accept:
50
+ - application/json
51
+ Accept-Encoding:
52
+ - gzip, deflate
53
+ Hawkular-Tenant:
54
+ - vcr-test-tenant-123
55
+ Tenantid:
56
+ - vcr-test-tenant-123
57
+ Content-Type:
58
+ - application/json
59
+ User-Agent:
60
+ - Ruby
61
+ response:
62
+ status:
63
+ code: 204
64
+ message: No Content
65
+ headers:
66
+ Connection:
67
+ - keep-alive
68
+ X-Powered-By:
69
+ - Undertow/1
70
+ Server:
71
+ - WildFly/9
72
+ Content-Length:
73
+ - '0'
74
+ Date:
75
+ - Fri, 30 Oct 2015 17:39:17 GMT
76
+ body:
77
+ encoding: UTF-8
78
+ string: ''
79
+ http_version:
80
+ recorded_at: Fri, 30 Oct 2015 17:39:17 GMT
81
+ - request:
82
+ method: get
83
+ uri: http://localhost:8080/hawkular/metrics/availability/<%= id %>/data/
84
+ body:
85
+ encoding: US-ASCII
86
+ string: ''
87
+ headers:
88
+ Accept:
89
+ - application/json
90
+ Accept-Encoding:
91
+ - gzip, deflate
92
+ Hawkular-Tenant:
93
+ - vcr-test-tenant-123
94
+ Tenantid:
95
+ - vcr-test-tenant-123
96
+ Content-Type:
97
+ - application/json
98
+ User-Agent:
99
+ - Ruby
100
+ response:
101
+ status:
102
+ code: 204
103
+ message: No Content
104
+ headers:
105
+ Connection:
106
+ - keep-alive
107
+ X-Powered-By:
108
+ - Undertow/1
109
+ Server:
110
+ - WildFly/9
111
+ Content-Length:
112
+ - '0'
113
+ Date:
114
+ - Fri, 30 Oct 2015 17:39:17 GMT
115
+ body:
116
+ encoding: UTF-8
117
+ string: ''
118
+ http_version:
119
+ recorded_at: Fri, 30 Oct 2015 17:39:17 GMT
120
+ - request:
121
+ method: post
122
+ uri: http://localhost:8080/hawkular/metrics/metrics/data
123
+ body:
124
+ encoding: UTF-8
125
+ string: '{"gauges":[{"id":"<%= id %>","data":[{"value":1.1,"timestamp":1446226757879}]}],"counters":[{"id":"<%= id %>","data":[{"value":1,"timestamp":1446226757879}]}],"availabilities":[{"id":"<%= id %>","data":[{"value":"down","timestamp":1446226757879}]}]}'
126
+ headers:
127
+ Accept:
128
+ - application/json
129
+ Accept-Encoding:
130
+ - gzip, deflate
131
+ Hawkular-Tenant:
132
+ - vcr-test-tenant-123
133
+ Tenantid:
134
+ - vcr-test-tenant-123
135
+ Content-Type:
136
+ - application/json
137
+ Content-Length:
138
+ - '330'
139
+ User-Agent:
140
+ - Ruby
141
+ response:
142
+ status:
143
+ code: 200
144
+ message: OK
145
+ headers:
146
+ Connection:
147
+ - keep-alive
148
+ X-Powered-By:
149
+ - Undertow/1
150
+ Server:
151
+ - WildFly/9
152
+ Content-Length:
153
+ - '0'
154
+ Date:
155
+ - Fri, 30 Oct 2015 17:39:17 GMT
156
+ body:
157
+ encoding: UTF-8
158
+ string: ''
159
+ http_version:
160
+ recorded_at: Fri, 30 Oct 2015 17:39:17 GMT
161
+ - request:
162
+ method: get
163
+ uri: http://localhost:8080/hawkular/metrics/counters/<%= id %>/data/
164
+ body:
165
+ encoding: US-ASCII
166
+ string: ''
167
+ headers:
168
+ Accept:
169
+ - application/json
170
+ Accept-Encoding:
171
+ - gzip, deflate
172
+ Hawkular-Tenant:
173
+ - vcr-test-tenant-123
174
+ Tenantid:
175
+ - vcr-test-tenant-123
176
+ Content-Type:
177
+ - application/json
178
+ User-Agent:
179
+ - Ruby
180
+ response:
181
+ status:
182
+ code: 200
183
+ message: OK
184
+ headers:
185
+ Connection:
186
+ - keep-alive
187
+ X-Powered-By:
188
+ - Undertow/1
189
+ Server:
190
+ - WildFly/9
191
+ Content-Type:
192
+ - application/json
193
+ Content-Length:
194
+ - '39'
195
+ Date:
196
+ - Fri, 30 Oct 2015 17:39:17 GMT
197
+ body:
198
+ encoding: UTF-8
199
+ string: '[{"timestamp":1446226757879,"value":1}]'
200
+ http_version:
201
+ recorded_at: Fri, 30 Oct 2015 17:39:17 GMT
202
+ - request:
203
+ method: get
204
+ uri: http://localhost:8080/hawkular/metrics/gauges/<%= id %>/data/
205
+ body:
206
+ encoding: US-ASCII
207
+ string: ''
208
+ headers:
209
+ Accept:
210
+ - application/json
211
+ Accept-Encoding:
212
+ - gzip, deflate
213
+ Hawkular-Tenant:
214
+ - vcr-test-tenant-123
215
+ Tenantid:
216
+ - vcr-test-tenant-123
217
+ Content-Type:
218
+ - application/json
219
+ User-Agent:
220
+ - Ruby
221
+ response:
222
+ status:
223
+ code: 200
224
+ message: OK
225
+ headers:
226
+ Connection:
227
+ - keep-alive
228
+ X-Powered-By:
229
+ - Undertow/1
230
+ Server:
231
+ - WildFly/9
232
+ Content-Type:
233
+ - application/json
234
+ Content-Length:
235
+ - '41'
236
+ Date:
237
+ - Fri, 30 Oct 2015 17:39:17 GMT
238
+ body:
239
+ encoding: UTF-8
240
+ string: '[{"timestamp":1446226757879,"value":1.1}]'
241
+ http_version:
242
+ recorded_at: Fri, 30 Oct 2015 17:39:17 GMT
243
+ - request:
244
+ method: get
245
+ uri: http://localhost:8080/hawkular/metrics/availability/<%= id %>/data/
246
+ body:
247
+ encoding: US-ASCII
248
+ string: ''
249
+ headers:
250
+ Accept:
251
+ - application/json
252
+ Accept-Encoding:
253
+ - gzip, deflate
254
+ Hawkular-Tenant:
255
+ - vcr-test-tenant-123
256
+ Tenantid:
257
+ - vcr-test-tenant-123
258
+ Content-Type:
259
+ - application/json
260
+ User-Agent:
261
+ - Ruby
262
+ response:
263
+ status:
264
+ code: 200
265
+ message: OK
266
+ headers:
267
+ Connection:
268
+ - keep-alive
269
+ X-Powered-By:
270
+ - Undertow/1
271
+ Server:
272
+ - WildFly/9
273
+ Content-Type:
274
+ - application/json
275
+ Content-Length:
276
+ - '44'
277
+ Date:
278
+ - Fri, 30 Oct 2015 17:39:17 GMT
279
+ body:
280
+ encoding: UTF-8
281
+ string: '[{"timestamp":1446226757879,"value":"down"}]'
282
+ http_version:
283
+ recorded_at: Fri, 30 Oct 2015 17:39:17 GMT
284
+ recorded_with: VCR 2.9.3