hawkular-client 0.1.0 → 0.1.1

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.
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,87 @@
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 %>","dataRetention":123,"tags":{"some":"value"},"tenantId":"vcr-test-tenant-123"}'
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
+ - '122'
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:28 GMT
41
+ body:
42
+ encoding: UTF-8
43
+ string: ''
44
+ http_version:
45
+ recorded_at: Fri, 30 Oct 2015 12:01:28 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
+ - '137'
80
+ Date:
81
+ - Fri, 30 Oct 2015 12:01:28 GMT
82
+ body:
83
+ encoding: UTF-8
84
+ string: '{"id":"<%= id %>","tags":{"some":"value"},"dataRetention":123,"type":"gauge","tenantId":"vcr-test-tenant-123"}'
85
+ http_version:
86
+ recorded_at: Fri, 30 Oct 2015 12:01:28 GMT
87
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,87 @@
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":"338ff3bf-4990-4ac7-b43f-c6cb2f9e2bea","dataRetention":90,"tags":{"tag":"value"}}'
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
+ - '87'
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:28 GMT
41
+ body:
42
+ encoding: UTF-8
43
+ string: ''
44
+ http_version:
45
+ recorded_at: Fri, 30 Oct 2015 12:01:28 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
+ - '135'
80
+ Date:
81
+ - Fri, 30 Oct 2015 12:01:28 GMT
82
+ body:
83
+ encoding: UTF-8
84
+ string: '{"id":"<%= id %>","tags":{"tag":"value"},"dataRetention":90,"type":"gauge","tenantId":"vcr-test-tenant-123"}'
85
+ http_version:
86
+ recorded_at: Fri, 30 Oct 2015 12:01:28 GMT
87
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,249 @@
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 %>"}'
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
+ - '45'
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: post
48
+ uri: http://localhost:8080/hawkular/metrics/gauges/<%= id %>/data
49
+ body:
50
+ encoding: UTF-8
51
+ string: '[{"value":1,"timestamp":1446206489117},{"value":2,"timestamp":1446206489127},{"value":3,"timestamp":1446206489137}]'
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
+ Content-Length:
64
+ - '115'
65
+ User-Agent:
66
+ - Ruby
67
+ response:
68
+ status:
69
+ code: 200
70
+ message: OK
71
+ headers:
72
+ Connection:
73
+ - keep-alive
74
+ X-Powered-By:
75
+ - Undertow/1
76
+ Server:
77
+ - WildFly/9
78
+ Content-Length:
79
+ - '0'
80
+ Date:
81
+ - Fri, 30 Oct 2015 12:01:29 GMT
82
+ body:
83
+ encoding: UTF-8
84
+ string: ''
85
+ http_version:
86
+ recorded_at: Fri, 30 Oct 2015 12:01:29 GMT
87
+ - request:
88
+ method: get
89
+ uri: http://localhost:8080/hawkular/metrics/gauges/<%= id %>/data/
90
+ body:
91
+ encoding: US-ASCII
92
+ string: ''
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
+ User-Agent:
105
+ - Ruby
106
+ response:
107
+ status:
108
+ code: 200
109
+ message: OK
110
+ headers:
111
+ Connection:
112
+ - keep-alive
113
+ X-Powered-By:
114
+ - Undertow/1
115
+ Server:
116
+ - WildFly/9
117
+ Content-Type:
118
+ - application/json
119
+ Content-Length:
120
+ - '121'
121
+ Date:
122
+ - Fri, 30 Oct 2015 12:01:29 GMT
123
+ body:
124
+ encoding: UTF-8
125
+ string: '[{"timestamp":1446206489137,"value":3.0},{"timestamp":1446206489127,"value":2.0},{"timestamp":1446206489117,"value":1.0}]'
126
+ http_version:
127
+ recorded_at: Fri, 30 Oct 2015 12:01:29 GMT
128
+ - request:
129
+ method: post
130
+ uri: http://localhost:8080/hawkular/metrics/gauges/<%= id %>/data
131
+ body:
132
+ encoding: UTF-8
133
+ string: '[{"value":4,"timestamp":1446206489202}]'
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
+ Content-Length:
146
+ - '39'
147
+ User-Agent:
148
+ - Ruby
149
+ response:
150
+ status:
151
+ code: 200
152
+ message: OK
153
+ headers:
154
+ Connection:
155
+ - keep-alive
156
+ X-Powered-By:
157
+ - Undertow/1
158
+ Server:
159
+ - WildFly/9
160
+ Content-Length:
161
+ - '0'
162
+ Date:
163
+ - Fri, 30 Oct 2015 12:01:29 GMT
164
+ body:
165
+ encoding: UTF-8
166
+ string: ''
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/gauges/<%= id %>/data/
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
+ - '161'
203
+ Date:
204
+ - Fri, 30 Oct 2015 12:01:29 GMT
205
+ body:
206
+ encoding: UTF-8
207
+ string: '[{"timestamp":1446206489202,"value":4.0},{"timestamp":1446206489137,"value":3.0},{"timestamp":1446206489127,"value":2.0},{"timestamp":1446206489117,"value":1.0}]'
208
+ http_version:
209
+ recorded_at: Fri, 30 Oct 2015 12:01:29 GMT
210
+ - request:
211
+ method: get
212
+ uri: http://localhost:8080/hawkular/metrics/counters/<%= id %>/data/?end=<%= ends %>&start=<%= starts %>
213
+ body:
214
+ encoding: US-ASCII
215
+ string: ''
216
+ headers:
217
+ Accept:
218
+ - application/json
219
+ Accept-Encoding:
220
+ - gzip, deflate
221
+ Hawkular-Tenant:
222
+ - vcr-test-tenant-123
223
+ Tenantid:
224
+ - vcr-test-tenant-123
225
+ Content-Type:
226
+ - application/json
227
+ User-Agent:
228
+ - Ruby
229
+ response:
230
+ status:
231
+ code: 204
232
+ message: No Content
233
+ headers:
234
+ Connection:
235
+ - keep-alive
236
+ X-Powered-By:
237
+ - Undertow/1
238
+ Server:
239
+ - WildFly/9
240
+ Content-Length:
241
+ - '0'
242
+ Date:
243
+ - Fri, 30 Oct 2015 12:01:29 GMT
244
+ body:
245
+ encoding: UTF-8
246
+ string: ''
247
+ http_version:
248
+ recorded_at: Fri, 30 Oct 2015 12:01:29 GMT
249
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,126 @@
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":3.1415926,"timestamp":1446206488982}]'
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
+ - '47'
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 %>/data/
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
+ - '47'
78
+ Date:
79
+ - Fri, 30 Oct 2015 12:01:29 GMT
80
+ body:
81
+ encoding: UTF-8
82
+ string: '[{"timestamp":1446206488982,"value":3.1415926}]'
83
+ http_version:
84
+ recorded_at: Fri, 30 Oct 2015 12:01:29 GMT
85
+ - request:
86
+ method: get
87
+ uri: http://localhost:8080/hawkular/metrics/gauges/<%= id %>
88
+ body:
89
+ encoding: US-ASCII
90
+ string: ''
91
+ headers:
92
+ Accept:
93
+ - application/json
94
+ Accept-Encoding:
95
+ - gzip, deflate
96
+ Hawkular-Tenant:
97
+ - vcr-test-tenant-123
98
+ Tenantid:
99
+ - vcr-test-tenant-123
100
+ Content-Type:
101
+ - application/json
102
+ User-Agent:
103
+ - Ruby
104
+ response:
105
+ status:
106
+ code: 200
107
+ message: OK
108
+ headers:
109
+ Connection:
110
+ - keep-alive
111
+ X-Powered-By:
112
+ - Undertow/1
113
+ Server:
114
+ - WildFly/9
115
+ Content-Type:
116
+ - application/json
117
+ Content-Length:
118
+ - '93'
119
+ Date:
120
+ - Fri, 30 Oct 2015 12:01:29 GMT
121
+ body:
122
+ encoding: UTF-8
123
+ string: '{"id":"<%= id %>","type":"gauge","tenantId":"vcr-test-tenant-123"}'
124
+ http_version:
125
+ recorded_at: Fri, 30 Oct 2015 12:01:29 GMT
126
+ recorded_with: VCR 2.9.3