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,249 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://localhost:8080/hawkular/metrics/metrics/data
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"gauges":[],"counters":[{"id":"<%= id %>","data":[{"value":1,"timestamp":1446226757457}]}],"availabilities":[]}'
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
+ - '139'
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 17:39:17 GMT
39
+ body:
40
+ encoding: UTF-8
41
+ string: ''
42
+ http_version:
43
+ recorded_at: Fri, 30 Oct 2015 17:39:17 GMT
44
+ - request:
45
+ method: get
46
+ uri: http://localhost:8080/hawkular/metrics/counters/<%= 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
+ - '39'
78
+ Date:
79
+ - Fri, 30 Oct 2015 17:39:17 GMT
80
+ body:
81
+ encoding: UTF-8
82
+ string: '[{"timestamp":1446226757457,"value":1}]'
83
+ http_version:
84
+ recorded_at: Fri, 30 Oct 2015 17:39:17 GMT
85
+ - request:
86
+ method: post
87
+ uri: http://localhost:8080/hawkular/metrics/metrics/data
88
+ body:
89
+ encoding: UTF-8
90
+ string: '{"gauges":[],"counters":[],"availabilities":[{"id":"<%= id %>","data":[{"value":"down","timestamp":1446226757572}]}]}'
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
+ Content-Length:
103
+ - '144'
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-Length:
118
+ - '0'
119
+ Date:
120
+ - Fri, 30 Oct 2015 17:39:17 GMT
121
+ body:
122
+ encoding: UTF-8
123
+ string: ''
124
+ http_version:
125
+ recorded_at: Fri, 30 Oct 2015 17:39:17 GMT
126
+ - request:
127
+ method: get
128
+ uri: http://localhost:8080/hawkular/metrics/availability/<%= id %>/data/
129
+ body:
130
+ encoding: US-ASCII
131
+ string: ''
132
+ headers:
133
+ Accept:
134
+ - application/json
135
+ Accept-Encoding:
136
+ - gzip, deflate
137
+ Hawkular-Tenant:
138
+ - vcr-test-tenant-123
139
+ Tenantid:
140
+ - vcr-test-tenant-123
141
+ Content-Type:
142
+ - application/json
143
+ User-Agent:
144
+ - Ruby
145
+ response:
146
+ status:
147
+ code: 200
148
+ message: OK
149
+ headers:
150
+ Connection:
151
+ - keep-alive
152
+ X-Powered-By:
153
+ - Undertow/1
154
+ Server:
155
+ - WildFly/9
156
+ Content-Type:
157
+ - application/json
158
+ Content-Length:
159
+ - '44'
160
+ Date:
161
+ - Fri, 30 Oct 2015 17:39:17 GMT
162
+ body:
163
+ encoding: UTF-8
164
+ string: '[{"timestamp":1446226757572,"value":"down"}]'
165
+ http_version:
166
+ recorded_at: Fri, 30 Oct 2015 17:39:17 GMT
167
+ - request:
168
+ method: post
169
+ uri: http://localhost:8080/hawkular/metrics/metrics/data
170
+ body:
171
+ encoding: UTF-8
172
+ string: '{"gauges":[{"id":"<%= id %>","data":[{"value":1.1,"timestamp":1446226757633}]}],"counters":[],"availabilities":[]}'
173
+ headers:
174
+ Accept:
175
+ - application/json
176
+ Accept-Encoding:
177
+ - gzip, deflate
178
+ Hawkular-Tenant:
179
+ - vcr-test-tenant-123
180
+ Tenantid:
181
+ - vcr-test-tenant-123
182
+ Content-Type:
183
+ - application/json
184
+ Content-Length:
185
+ - '141'
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-Length:
200
+ - '0'
201
+ Date:
202
+ - Fri, 30 Oct 2015 17:39:17 GMT
203
+ body:
204
+ encoding: UTF-8
205
+ string: ''
206
+ http_version:
207
+ recorded_at: Fri, 30 Oct 2015 17:39:17 GMT
208
+ - request:
209
+ method: get
210
+ uri: http://localhost:8080/hawkular/metrics/gauges/<%= id %>/data/
211
+ body:
212
+ encoding: US-ASCII
213
+ string: ''
214
+ headers:
215
+ Accept:
216
+ - application/json
217
+ Accept-Encoding:
218
+ - gzip, deflate
219
+ Hawkular-Tenant:
220
+ - vcr-test-tenant-123
221
+ Tenantid:
222
+ - vcr-test-tenant-123
223
+ Content-Type:
224
+ - application/json
225
+ User-Agent:
226
+ - Ruby
227
+ response:
228
+ status:
229
+ code: 200
230
+ message: OK
231
+ headers:
232
+ Connection:
233
+ - keep-alive
234
+ X-Powered-By:
235
+ - Undertow/1
236
+ Server:
237
+ - WildFly/9
238
+ Content-Type:
239
+ - application/json
240
+ Content-Length:
241
+ - '41'
242
+ Date:
243
+ - Fri, 30 Oct 2015 17:39:17 GMT
244
+ body:
245
+ encoding: UTF-8
246
+ string: '[{"timestamp":1446226757633,"value":1.1}]'
247
+ http_version:
248
+ recorded_at: Fri, 30 Oct 2015 17:39:17 GMT
249
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,208 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:8080/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
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
+ Host:
17
+ - localhost:8080
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Connection:
24
+ - keep-alive
25
+ Last-Modified:
26
+ - Wed, 28 Oct 2015 11:28:32 GMT
27
+ X-Powered-By:
28
+ - Undertow/1
29
+ Server:
30
+ - WildFly/9
31
+ Content-Type:
32
+ - text/html
33
+ Content-Length:
34
+ - '9123'
35
+ Date:
36
+ - Thu, 29 Oct 2015 21:05:27 GMT
37
+ body:
38
+ encoding: UTF-8
39
+ string: |
40
+ <!DOCTYPE html>
41
+ <html>
42
+
43
+ <head>
44
+ <title>Hawkular - The OpenSource monitoring platform</title>
45
+ <base href='/'>
46
+ <meta charset="UTF8">
47
+
48
+ <!-- bower:css -->
49
+ <link rel="stylesheet" href="libs/angular-ui-select/dist/select.css?v=1446031712077" />
50
+ <link rel="stylesheet" href="libs/angular-toastr/dist/angular-toastr.css?v=1446031712077" />
51
+ <link rel="stylesheet" href="libs/animate.css/animate.css?v=1446031712077" />
52
+ <link rel="stylesheet" href="libs/bootstrap-select/dist/css/bootstrap-select.css?v=1446031712077" />
53
+ <link rel="stylesheet" href="libs/hawkular-charts/css/hawkular-charts.css?v=1446031712077" />
54
+ <link rel="stylesheet" href="libs/patternfly/dist/css/patternfly.css?v=1446031712077" />
55
+ <link rel="stylesheet" href="libs/patternfly/dist/css/patternfly-additions.css?v=1446031712077" />
56
+ <link rel="stylesheet" href="libs/angular-wizard/dist/angular-wizard.min.css?v=1446031712077" />
57
+ <!-- endbower -->
58
+ <link href="dist/hawkular-console.css?v=2015-10-28T11:22:41Z" rel="stylesheet">
59
+
60
+ <!-- ES6/ES6 shim -->
61
+ <!--[if IE 8]>
62
+ <script src="libs/es5-dom-shim/__COMIPLE/a.ie8.js"></script>
63
+ <![endif]-->
64
+ <script src="libs/es5-dom-shim/__COMPILE/a.js"></script>
65
+ <script src="libs/patternfly/components/jquery/dist/jquery.js"></script>
66
+ <script src="libs/patternfly/components/bootstrap/dist/js/bootstrap.js"></script>
67
+
68
+ <!-- bower:js -->
69
+ <script src="libs/jquery/dist/jquery.js?v=1446031712077"></script>
70
+ <script src="libs/angular/angular.js?v=1446031712077"></script>
71
+ <script src="libs/angular-animate/angular-animate.js?v=1446031712077"></script>
72
+ <script src="libs/angular-bootstrap/ui-bootstrap-tpls.js?v=1446031712077"></script>
73
+ <script src="libs/angular-md5/angular-md5.js?v=1446031712077"></script>
74
+ <script src="libs/moment/moment.js?v=1446031712077"></script>
75
+ <script src="libs/angular-momentjs/angular-momentjs.js?v=1446031712077"></script>
76
+ <script src="libs/angular-patternfly/dist/angular-patternfly.js?v=1446031712077"></script>
77
+ <script src="libs/angular-scroll/angular-scroll.js?v=1446031712077"></script>
78
+ <script src="libs/angular-ui-select/dist/select.js?v=1446031712077"></script>
79
+ <script src="libs/angular-toastr/dist/angular-toastr.tpls.js?v=1446031712077"></script>
80
+ <script src="libs/ngInfiniteScroll/build/ng-infinite-scroll.js?v=1446031712077"></script>
81
+ <script src="libs/bootstrap-select/dist/js/bootstrap-select.js?v=1446031712077"></script>
82
+ <script src="libs/d3/d3.js?v=1446031712077"></script>
83
+ <script src="libs/d3-tip/index.js?v=1446031712077"></script>
84
+ <script src="libs/hawkular-charts/hawkular-charts.js?v=1446031712077"></script>
85
+ <script src="libs/angular-resource/angular-resource.js?v=1446031712077"></script>
86
+ <script src="libs/lodash/lodash.js?v=1446031712077"></script>
87
+ <script src="libs/hawkular-ui-services/dist/hawkular-ui-service.js?v=1446031712077"></script>
88
+ <script src="libs/angular-sanitize/angular-sanitize.js?v=1446031712077"></script>
89
+ <script src="libs/js-logger/src/logger.js?v=1446031712077"></script>
90
+ <script src="libs/hawtio-core/hawtio-core.js?v=1446031712077"></script>
91
+ <script src="libs/angular-route/angular-route.js?v=1446031712077"></script>
92
+ <script src="libs/uri.js/src/URI.js?v=1446031712077"></script>
93
+ <script src="libs/uri.js/src/IPv6.js?v=1446031712077"></script>
94
+ <script src="libs/uri.js/src/SecondLevelDomains.js?v=1446031712077"></script>
95
+ <script src="libs/uri.js/src/punycode.js?v=1446031712077"></script>
96
+ <script src="libs/uri.js/src/URITemplate.js?v=1446031712077"></script>
97
+ <script src="libs/uri.js/src/jquery.URI.js?v=1446031712077"></script>
98
+ <script src="libs/uri.js/src/URI.min.js?v=1446031712077"></script>
99
+ <script src="libs/uri.js/src/jquery.URI.min.js?v=1446031712077"></script>
100
+ <script src="libs/uri.js/src/URI.fragmentQuery.js?v=1446031712077"></script>
101
+ <script src="libs/uri.js/src/URI.fragmentURI.js?v=1446031712077"></script>
102
+ <script src="libs/hawtio-core-navigation/dist/hawtio-core-navigation.js?v=1446031712077"></script>
103
+ <script src="libs/hawtio-template-cache/dist/hawtio-template-cache.js?v=1446031712077"></script>
104
+ <script src="libs/hawtio-utilities/dist/sugar.js?v=1446031712077"></script>
105
+ <script src="libs/hawtio-utilities/dist/angular-file-upload.js?v=1446031712077"></script>
106
+ <script src="libs/hawtio-utilities/dist/hawtio-utilities.js?v=1446031712077"></script>
107
+ <script src="libs/hawtio-extension-service/dist/hawtio-extension-service.js?v=1446031712077"></script>
108
+ <script src="libs/keycloak/dist/keycloak.js?v=1446031712077"></script>
109
+ <script src="libs/ng-idle/angular-idle.js?v=1446031712077"></script>
110
+ <script src="libs/hawtio-oauth/dist/hawtio-oauth.js?v=1446031712077"></script>
111
+ <script src="libs/patternfly/dist/js/patternfly.js?v=1446031712077"></script>
112
+ <script src="libs/angular-truncate/src/truncate.js?v=1446031712077"></script>
113
+ <script src="libs/angular-smart-truncate/dist/angular-smart-truncate.js?v=1446031712077"></script>
114
+ <script src="libs/angular-wizard/dist/angular-wizard.min.js?v=1446031712077"></script>
115
+ <!-- endbower -->
116
+ </head>
117
+
118
+ <body class="ng-cloak" ng-controller="GlobalController as global">
119
+ <nav class="navbar navbar-default navbar-pf" role="navigation">
120
+ <div idle-countdown="countdown" ng-init="countdown=30" id="idle">
121
+ <strong>You'll be logged out in {{countdown}} second(s).</strong>.
122
+ </div>
123
+
124
+ <div>
125
+ <div class="navbar-header">
126
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse-1">
127
+ <span class="sr-only">Toggle navigation</span>
128
+ <span class="icon-bar"></span>
129
+ <span class="icon-bar"></span>
130
+ <span class="icon-bar"></span>
131
+ </button>
132
+ <a class="navbar-brand" ng-click="global.experimentalMode()" >
133
+ <img id="hawkularLogo" src="resources/img/brand.svg"
134
+ alt="RED HAT JBOSS HAWKULAR Management Console" title="Hawkular">
135
+ </a>
136
+ </div>
137
+ <div class="collapse navbar-collapse navbar-collapse-1">
138
+ <ul class="nav navbar-nav navbar-utility pull-right">
139
+ <li class="dropdown">
140
+ <a href="#" dropdown-toggle>
141
+ Red Hat Access <b class="caret"></b>
142
+ </a>
143
+ <ul class="dropdown-menu">
144
+ <li><a href="/hawkular-ui/access/search">Search</a></li>
145
+ <li class="dropdown-submenu">
146
+ <a data-toggle="dropdown" tabindex="-1" href="#">Support</a>
147
+ <ul class="dropdown-menu">
148
+ <li><a href="/hawkular-ui/access/openCase">Open Case</a></li>
149
+ <li><a href="/hawkular-ui/access/myCases">My Cases</a></li>
150
+ </ul>
151
+ </li>
152
+ </ul>
153
+ </li>
154
+ <li class="dropdown" ng-controller="HawkularAccounts.PersonaController as personaController">
155
+ <a href="#" dropdown-toggle>
156
+ <span class="pficon pficon-user"></span>
157
+ {{personaController.currentPersona.name}} <b class="caret"></b>
158
+ </a>
159
+ <ul class="dropdown-menu" id="personaSwitcher">
160
+ <li class="text-muted hk-using">Use Hawkular as:</li>
161
+ <li ng-repeat="persona in personaController.personas"
162
+ ng-class="{'active': persona.id === currentPersona.id}">
163
+ <a href="#" ng-click="personaController.switchPersona(persona)">
164
+ <i class="fa fa-check"
165
+ ng-class="{'hk-invisible': persona.id !== personaController.currentPersona.id}"></i>
166
+ {{persona.name}}
167
+ </a>
168
+ </li>
169
+ <li class="divider" ng-show="personaController.personas.length"></li>
170
+ <li>
171
+ <a id="organizationsOption" href="/hawkular-ui/organizations">Manage Organizations</a>
172
+ </li>
173
+ <li>
174
+ <a id="userSettingsOption" href="/hawkular-ui/settings">User Settings</a>
175
+ </li>
176
+ <li class="divider"></li>
177
+ <li>
178
+ <a id="logout" href="#" ng-click="userDetails.logout()">Log Out</a>
179
+ </li>
180
+ </ul>
181
+ </li>
182
+ </ul>
183
+ <hawkular-topbar ng-controller="Topbar.TopbarController"></hawkular-topbar>
184
+ </div>
185
+ </div>
186
+ </nav>
187
+
188
+ <div ng-controller="HawtioNav.ViewController">
189
+ <div class="container screen-content" ng-include src="viewPartial"></div>
190
+ </div>
191
+
192
+ <div ng-non-bindable data-$injector="">
193
+ <div id="redhat-access-cases">
194
+ <div ui-view autoscroll="false"></div>
195
+ </div>
196
+ </div>
197
+
198
+ <!-- add any scripts under dist/ here -->
199
+ <script src="dist/hawkular-console.js?v=2015-10-28T11:22:41Z"></script>
200
+ <script>
201
+ var title = 'HAWKULAR: ' + HawkularVersion;
202
+ document.getElementById("hawkularLogo").title = title;
203
+ </script>
204
+ </body>
205
+ </html>
206
+ http_version:
207
+ recorded_at: Thu, 29 Oct 2015 21:05:27 GMT
208
+ recorded_with: VCR 2.9.3