request_response_stats 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +331 -13
- data/lib/generators/request_response_stats/customization_generator.rb +21 -0
- data/lib/{tasks → generators/templates}/move_req_res_cycle_data_from_redis_to_mongo.rake +0 -0
- data/lib/{req_res_stat_controller.rb → generators/templates/req_res_stat_controller.rb} +0 -0
- data/lib/{request_response_stats_config.rb → generators/templates/request_response_stats_config.rb} +6 -0
- data/lib/request_response_stats/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bde5823cb6c377d0f0544a0efb22523aa6758f7
|
4
|
+
data.tar.gz: 14d4ed2106fa3dd22dfcd225121fdf1efc95bbcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76c678ce28f903ee6a8badfe44e94cff931346ca0cb24ba44203fe17917bcfb4ee2510ba478f6f08ed39875f45e4e58c97d81298ecff8c9b3ba8cbaa57d789e6
|
7
|
+
data.tar.gz: 610074ebd7f4e68aae4854d492a04b8c59dff454cf0ac4ae6d050a238e738bf56dba6187f970ade1502f60194cb36fbaab4be3ec703e8ca78de37ed234f21e70
|
data/README.md
CHANGED
@@ -1,5 +1,31 @@
|
|
1
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
2
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
3
|
+
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
|
4
|
+
|
5
|
+
- [RequestResponseStats](#requestresponsestats)
|
6
|
+
- [Prerequisites](#prerequisites)
|
7
|
+
- [Installation](#installation)
|
8
|
+
- [Usage](#usage)
|
9
|
+
- [Documentation References](#documentation-references)
|
10
|
+
- [Checking current data in redis](#checking-current-data-in-redis)
|
11
|
+
- [Manually moving data from Redis to Mongo](#manually-moving-data-from-redis-to-mongo)
|
12
|
+
- [Deleting data from Redis and Mongo](#deleting-data-from-redis-and-mongo)
|
13
|
+
- [Getting stats from Mongo](#getting-stats-from-mongo)
|
14
|
+
- [Development](#development)
|
15
|
+
- [Contributing](#contributing)
|
16
|
+
- [License](#license)
|
17
|
+
- [Code of Conduct](#code-of-conduct)
|
18
|
+
|
19
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
20
|
+
|
1
21
|
# RequestResponseStats
|
2
22
|
|
23
|
+
## Prerequisites
|
24
|
+
|
25
|
+
The gem uses [Redis](https://github.com/redis/redis-rb) as a temporary storage to store the captured stats data. For permanent storage of this data, [MongoDB](https://github.com/mongodb/mongoid) is being used.
|
26
|
+
|
27
|
+
You can pass your redis connection (by default, it is assumed to be available through `$redis`) and mongoid_doc_model (by default, it is named `ReqResStat`) thorugh `RequestResponseStats::RequestResponse.new`.
|
28
|
+
|
3
29
|
## Installation
|
4
30
|
|
5
31
|
Add gem to your application's Gemfile:
|
@@ -29,39 +55,195 @@ class ApplicationController < ActionController::Base
|
|
29
55
|
end
|
30
56
|
```
|
31
57
|
|
32
|
-
|
58
|
+
Generate customization files:
|
33
59
|
|
34
|
-
|
35
|
-
|
36
|
-
|
60
|
+
```ruby
|
61
|
+
$ rails g request_response_stats:customization
|
62
|
+
```
|
37
63
|
|
38
|
-
|
64
|
+
Configure `config/initializers/request_response_stat_config.rb` as per your requirement.
|
39
65
|
|
40
66
|
## Usage
|
41
67
|
|
42
68
|
### Documentation References
|
43
69
|
|
44
|
-
http://www.rubydoc.info/gems/request_response_stats/
|
70
|
+
Refer: http://www.rubydoc.info/gems/request_response_stats/
|
45
71
|
|
46
|
-
|
47
|
-
|
48
|
-
TODO: Include examples for below commands.
|
72
|
+
But, you can get better documentation by running tests :wink:.
|
49
73
|
|
50
74
|
### Checking current data in redis
|
51
75
|
|
52
76
|
```ruby
|
53
77
|
# include RequestResponseStats
|
54
78
|
rrs = RequestResponse.new(nil, nil)
|
55
|
-
rrs.redis_record.
|
79
|
+
rrs.redis_record.all_keys
|
80
|
+
rrs.redis_record.all_keys(support: true)
|
81
|
+
# [
|
82
|
+
# [ 0] "api_req_res_SUPPORT_Munishs-MacBook-Pro.local_Munishs-MacBook-Pro.local_memory",
|
83
|
+
# [ 1] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/words_GET_2017-12-03-0202",
|
84
|
+
# [ 2] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/words_GET_2017-12-03-0200",
|
85
|
+
# [ 3] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/words/6/ajax_promote_flag_GET_2017-12-03-0200",
|
86
|
+
# [ 4] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/words/5/ajax_promote_flag_GET_2017-12-03-0200",
|
87
|
+
# [ 5] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/words/4_GET_2017-12-03-0200",
|
88
|
+
# [ 6] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/words/3_GET_2017-12-03-0202",
|
89
|
+
# [ 7] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/words/3_GET_2017-12-03-0200",
|
90
|
+
# [ 8] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/words/2_GET_2017-12-03-0200",
|
91
|
+
# [ 9] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/words/1/ajax_promote_flag_GET_2017-12-03-0202",
|
92
|
+
# [10] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/users_GET_2017-12-03-0205",
|
93
|
+
# [11] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/users_GET_2017-12-03-0202",
|
94
|
+
# [12] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/users_GET_2017-12-03-0201",
|
95
|
+
# [13] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/generals/2_GET_2017-12-03-0205",
|
96
|
+
# [14] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/flags_GET_2017-12-03-0202",
|
97
|
+
# [15] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/dictionaries_GET_2017-12-03-0201",
|
98
|
+
# [16] "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/admins/1_GET_2017-12-03-0201"
|
99
|
+
# ]
|
100
|
+
rrs.redis_record.all_keys.size
|
101
|
+
# 16
|
56
102
|
rrs.redis_record.hashify_all_data
|
57
103
|
```
|
58
104
|
|
105
|
+
Example on how data within each key looks like:
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
rrs.redis_record.hashify_all_data["api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/words/1/ajax_promote_flag_GET_2017-12-03-0202"]
|
109
|
+
# =>
|
110
|
+
{
|
111
|
+
"key_name" => "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/words/1/ajax_promote_flag_GET_2017-12-03-0202",
|
112
|
+
"server_name" => "Munishs-MacBook-Pro.local",
|
113
|
+
"api_name" => "/words/1/ajax_promote_flag",
|
114
|
+
"api_verb" => "GET",
|
115
|
+
"api_controller" => "words",
|
116
|
+
"api_action" => "ajax_promote_flag",
|
117
|
+
"request_count" => 3,
|
118
|
+
"min_time" => 0.06,
|
119
|
+
"max_time" => 0.095,
|
120
|
+
"avg_time" => 0.075,
|
121
|
+
"start_time" => "2017-12-03 03:22:00 UTC",
|
122
|
+
"end_time" => "2017-12-03 03:23:00 UTC",
|
123
|
+
"error_count" => 0,
|
124
|
+
"min_used_memory_MB" => 0,
|
125
|
+
"max_used_memory_MB" => 0,
|
126
|
+
"avg_used_memory_MB" => 0,
|
127
|
+
"min_swap_memory_MB" => 0,
|
128
|
+
"max_swap_memory_MB" => 0,
|
129
|
+
"avg_swap_memory_MB" => 0,
|
130
|
+
"avg_gc_stat_diff" => {
|
131
|
+
"count" => 0,
|
132
|
+
"heap_allocated_pages" => 0,
|
133
|
+
"heap_sorted_length" => 0,
|
134
|
+
"heap_allocatable_pages" => 0,
|
135
|
+
"heap_available_slots" => 0,
|
136
|
+
"heap_live_slots" => -1212,
|
137
|
+
"heap_free_slots" => -106,
|
138
|
+
"heap_final_slots" => 0,
|
139
|
+
"heap_marked_slots" => -1563,
|
140
|
+
"heap_swept_slots" => -91636,
|
141
|
+
"heap_eden_pages" => -3,
|
142
|
+
"heap_tomb_pages" => 0,
|
143
|
+
"total_allocated_pages" => 0,
|
144
|
+
"total_freed_pages" => 0,
|
145
|
+
"total_allocated_objects" => 12121,
|
146
|
+
"total_freed_objects" => 12025,
|
147
|
+
"malloc_increase_bytes" => 178165,
|
148
|
+
"malloc_increase_bytes_limit" => -186507,
|
149
|
+
"minor_gc_count" => 0,
|
150
|
+
"major_gc_count" => 0,
|
151
|
+
"remembered_wb_unprotected_objects" => 0,
|
152
|
+
"remembered_wb_unprotected_objects_limit" => 0,
|
153
|
+
"old_objects" => 0,
|
154
|
+
"old_objects_limit" => 0,
|
155
|
+
"oldmalloc_increase_bytes" => -134054,
|
156
|
+
"oldmalloc_increase_bytes_limit" => 0
|
157
|
+
},
|
158
|
+
"min_gc_stat_diff" => {
|
159
|
+
"count" => 0,
|
160
|
+
"heap_allocated_pages" => 0,
|
161
|
+
"heap_sorted_length" => 0,
|
162
|
+
"heap_allocatable_pages" => 0,
|
163
|
+
"heap_available_slots" => 0,
|
164
|
+
"heap_live_slots" => -3846,
|
165
|
+
"heap_free_slots" => -106,
|
166
|
+
"heap_final_slots" => 0,
|
167
|
+
"heap_marked_slots" => -4688,
|
168
|
+
"heap_swept_slots" => -300588,
|
169
|
+
"heap_eden_pages" => -9,
|
170
|
+
"heap_tomb_pages" => 0,
|
171
|
+
"total_allocated_pages" => 0,
|
172
|
+
"total_freed_pages" => 0,
|
173
|
+
"total_allocated_objects" => 10513,
|
174
|
+
"total_freed_objects" => 10437,
|
175
|
+
"malloc_increase_bytes" => -324416,
|
176
|
+
"malloc_increase_bytes_limit" => -559519,
|
177
|
+
"minor_gc_count" => 0,
|
178
|
+
"major_gc_count" => 0,
|
179
|
+
"remembered_wb_unprotected_objects" => 0,
|
180
|
+
"remembered_wb_unprotected_objects_limit" => 0,
|
181
|
+
"old_objects" => 0,
|
182
|
+
"old_objects_limit" => 0,
|
183
|
+
"oldmalloc_increase_bytes" => -1261072,
|
184
|
+
"oldmalloc_increase_bytes_limit" => 0
|
185
|
+
},
|
186
|
+
"max_gc_stat_diff" => {
|
187
|
+
"count" => 0,
|
188
|
+
"heap_allocated_pages" => 0,
|
189
|
+
"heap_sorted_length" => 0,
|
190
|
+
"heap_allocatable_pages" => 0,
|
191
|
+
"heap_available_slots" => 0,
|
192
|
+
"heap_live_slots" => 106,
|
193
|
+
"heap_free_slots" => -106,
|
194
|
+
"heap_final_slots" => 0,
|
195
|
+
"heap_marked_slots" => 0,
|
196
|
+
"heap_swept_slots" => 12840,
|
197
|
+
"heap_eden_pages" => 0,
|
198
|
+
"heap_tomb_pages" => 0,
|
199
|
+
"total_allocated_pages" => 0,
|
200
|
+
"total_freed_pages" => 0,
|
201
|
+
"total_allocated_objects" => 12925,
|
202
|
+
"total_freed_objects" => 12819,
|
203
|
+
"malloc_increase_bytes" => 429456,
|
204
|
+
"malloc_increase_bytes_limit" => 0,
|
205
|
+
"minor_gc_count" => 0,
|
206
|
+
"major_gc_count" => 0,
|
207
|
+
"remembered_wb_unprotected_objects" => 0,
|
208
|
+
"remembered_wb_unprotected_objects_limit" => 0,
|
209
|
+
"old_objects" => 0,
|
210
|
+
"old_objects_limit" => 0,
|
211
|
+
"oldmalloc_increase_bytes" => 429456,
|
212
|
+
"oldmalloc_increase_bytes_limit" => 0
|
213
|
+
}
|
214
|
+
}
|
215
|
+
=> nil
|
216
|
+
```
|
217
|
+
|
218
|
+
The gem uses [free](https://linux.die.net/man/1/free) command to capture memory information of the server. If this command is not available (such as on Mac), then zeros are reported, as you can see in memory keys (keys ending with `memory_MB`) in the above example.
|
219
|
+
|
220
|
+
The last part of the key (such as `0202` in the above key) represents slot within a day. By default, `GROUP_STATS_BY_TIME_DURATION` is set as `1.minute`, so there are `24*60` slots in a day. You can easily configure these settings by overriding these configuration in`request_response_stats_config.rb`.
|
221
|
+
|
222
|
+
The `request_count` key, within data of a single key, gives the number of requests received for a given endpoint in a given timeslot.
|
223
|
+
|
224
|
+
For example,
|
225
|
+
|
226
|
+
```ruby
|
227
|
+
rrs.redis_record.get_slot_range_for_key "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/words/1/ajax_promote_flag_GET_2017-12-03-0202"
|
228
|
+
# =>
|
229
|
+
[
|
230
|
+
[0] 2017-12-03 03:22:00 UTC,
|
231
|
+
[1] 2017-12-03 03:23:00 UTC
|
232
|
+
]
|
233
|
+
```
|
234
|
+
|
235
|
+
This means that the server `Munishs-MacBook-Pro.local` received `3` (as reported by `request_count`) `GET` requests in between `2017-12-03 03:22:00 UTC` and `2017-12-03 03:23:00 UTC` for the endpoint `/words/1/ajax_promote_flag`.
|
236
|
+
|
59
237
|
### Manually moving data from Redis to Mongo
|
60
238
|
|
239
|
+
Moving freezed, non-support keys from Redis to Mongo:
|
240
|
+
|
61
241
|
```ruby
|
62
|
-
rrs.move_data_from_redis_to_mongo
|
242
|
+
rrs.move_data_from_redis_to_mongo
|
243
|
+
# => 16
|
63
244
|
```
|
64
|
-
|
245
|
+
|
246
|
+
Note: Make use of `lib/tasks/move_req_res_cycle_data_from_redis_to_mongo.rake` to schedule this task using cron.
|
65
247
|
|
66
248
|
### Deleting data from Redis and Mongo
|
67
249
|
|
@@ -73,13 +255,149 @@ ReqResStat.all.delete_all
|
|
73
255
|
### Getting stats from Mongo
|
74
256
|
|
75
257
|
```ruby
|
76
|
-
ReqResStat.all.size
|
258
|
+
ReqResStat.all.size # => 16
|
77
259
|
ReqResStat.all.first
|
260
|
+
# => #<RequestResponseStats::ReqResStat _id: 5a237d55af9080aa7890a968, key_name: "api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/words_GET_2017-12-03-0202", server_name: "Munishs-MacBook-Pro.local", api_name: "/words", api_verb: "GET", api_controller: "words", api_action: "index", request_count: 2, min_time: 2.392, max_time: 2.518, avg_time: 2.455, start_time: 2017-12-03 03:22:00 UTC, end_time: 2017-12-03 03:23:00 UTC, error_count: 0, min_used_memory_MB: 0, max_used_memory_MB: 0, avg_used_memory_MB: 0, min_swap_memory_MB: 0, max_swap_memory_MB: 0, avg_swap_memory_MB: 0, avg_gc_stat_diff: {"count"=>2, "heap_allocated_pages"=>0, "heap_sorted_length"=>0, "heap_allocatable_pages"=>0, "heap_available_slots"=>0, "heap_live_slots"=>-84476, "heap_free_slots"=>41108, "heap_final_slots"=>0, "heap_marked_slots"=>30927, "heap_swept_slots"=>76787, "heap_eden_pages"=>11, "heap_tomb_pages"=>-16, "total_allocated_pages"=>0, "total_freed_pages"=>0, "total_allocated_objects"=>687446, "total_freed_objects"=>732295, "malloc_increase_bytes"=>-517200, "malloc_increase_bytes_limit"=>-1131380, "minor_gc_count"=>2, "major_gc_count"=>0, "remembered_wb_unprotected_objects"=>2595, "remembered_wb_unprotected_objects_limit"=>0, "old_objects"=>21045, "old_objects_limit"=>0, "oldmalloc_increase_bytes"=>-4731008, "oldmalloc_increase_bytes_limit"=>0}, min_gc_stat_diff: {"count"=>2, "heap_allocated_pages"=>0, "heap_sorted_length"=>0, "heap_allocatable_pages"=>0, "heap_available_slots"=>0, "heap_live_slots"=>-84476, "heap_free_slots"=>-2260, "heap_final_slots"=>0, "heap_marked_slots"=>30927, "heap_swept_slots"=>7213, "heap_eden_pages"=>6, "heap_tomb_pages"=>-16, "total_allocated_pages"=>0, "total_freed_pages"=>0, "total_allocated_objects"=>687446, "total_freed_objects"=>692668, "malloc_increase_bytes"=>-517200, "malloc_increase_bytes_limit"=>-1177069, "minor_gc_count"=>2, "major_gc_count"=>0, "remembered_wb_unprotected_objects"=>2329, "remembered_wb_unprotected_objects_limit"=>0, "old_objects"=>21045, "old_objects_limit"=>0, "oldmalloc_increase_bytes"=>-4731008, "oldmalloc_increase_bytes_limit"=>0}, max_gc_stat_diff: {"count"=>2, "heap_allocated_pages"=>0, "heap_sorted_length"=>0, "heap_allocatable_pages"=>0, "heap_available_slots"=>0, "heap_live_slots"=>-84476, "heap_free_slots"=>84476, "heap_final_slots"=>0, "heap_marked_slots"=>30927, "heap_swept_slots"=>146361, "heap_eden_pages"=>16, "heap_tomb_pages"=>-16, "total_allocated_pages"=>0, "total_freed_pages"=>0, "total_allocated_objects"=>687446, "total_freed_objects"=>771922, "malloc_increase_bytes"=>-517200, "malloc_increase_bytes_limit"=>-1085691, "minor_gc_count"=>2, "major_gc_count"=>0, "remembered_wb_unprotected_objects"=>2862, "remembered_wb_unprotected_objects_limit"=>0, "old_objects"=>21045, "old_objects_limit"=>0, "oldmalloc_increase_bytes"=>-4731008, "oldmalloc_increase_bytes_limit"=>0}>
|
78
261
|
t = Time.now
|
79
262
|
ReqResStat.get_max(:max_time, t - 2.day, t, 6.hours).map{|r| r[:data]}
|
263
|
+
# => [nil, nil, nil, nil, nil, nil, nil, 3.96]
|
80
264
|
ReqResStat.get_avg(:avg_time, t - 2.day, t, 6.hours).map{|r| r[:data]}
|
265
|
+
# => [0, 0, 0, 0, 0, 0, 0, 0.72]
|
81
266
|
ReqResStat.get_max(:min_time, t - 2.day, t, 6.hours).map{|r| r[:data]}
|
82
267
|
ReqResStat.get_details(:max_time, t - 2.day, t, nil, 6.hours)
|
268
|
+
# =>
|
269
|
+
[
|
270
|
+
[0] {
|
271
|
+
:data => {},
|
272
|
+
:start_time => 2017-12-01 04:33:38 UTC,
|
273
|
+
:end_time => 2017-12-01 10:33:38 UTC
|
274
|
+
},
|
275
|
+
[1] {
|
276
|
+
:data => {},
|
277
|
+
:start_time => 2017-12-01 10:33:38 UTC,
|
278
|
+
:end_time => 2017-12-01 16:33:38 UTC
|
279
|
+
},
|
280
|
+
[2] {
|
281
|
+
:data => {},
|
282
|
+
:start_time => 2017-12-01 16:33:38 UTC,
|
283
|
+
:end_time => 2017-12-01 22:33:38 UTC
|
284
|
+
},
|
285
|
+
[3] {
|
286
|
+
:data => {},
|
287
|
+
:start_time => 2017-12-01 22:33:38 UTC,
|
288
|
+
:end_time => 2017-12-02 04:33:38 UTC
|
289
|
+
},
|
290
|
+
[4] {
|
291
|
+
:data => {},
|
292
|
+
:start_time => 2017-12-02 04:33:38 UTC,
|
293
|
+
:end_time => 2017-12-02 10:33:38 UTC
|
294
|
+
},
|
295
|
+
[5] {
|
296
|
+
:data => {},
|
297
|
+
:start_time => 2017-12-02 10:33:38 UTC,
|
298
|
+
:end_time => 2017-12-02 16:33:38 UTC
|
299
|
+
},
|
300
|
+
[6] {
|
301
|
+
:data => {},
|
302
|
+
:start_time => 2017-12-02 16:33:38 UTC,
|
303
|
+
:end_time => 2017-12-02 22:33:38 UTC
|
304
|
+
},
|
305
|
+
[7] {
|
306
|
+
:data => {
|
307
|
+
"Munishs-MacBook-Pro.local_/words_GET" => [
|
308
|
+
[0] {
|
309
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/words_GET",
|
310
|
+
:data => 2.518
|
311
|
+
},
|
312
|
+
[1] {
|
313
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/words_GET",
|
314
|
+
:data => 3.962
|
315
|
+
}
|
316
|
+
],
|
317
|
+
"Munishs-MacBook-Pro.local_/words/6/ajax_promote_flag_GET" => [
|
318
|
+
[0] {
|
319
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/words/6/ajax_promote_flag_GET",
|
320
|
+
:data => 0.118
|
321
|
+
}
|
322
|
+
],
|
323
|
+
"Munishs-MacBook-Pro.local_/words/5/ajax_promote_flag_GET" => [
|
324
|
+
[0] {
|
325
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/words/5/ajax_promote_flag_GET",
|
326
|
+
:data => 0.069
|
327
|
+
}
|
328
|
+
],
|
329
|
+
"Munishs-MacBook-Pro.local_/words/4_GET" => [
|
330
|
+
[0] {
|
331
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/words/4_GET",
|
332
|
+
:data => 0.526
|
333
|
+
}
|
334
|
+
],
|
335
|
+
"Munishs-MacBook-Pro.local_/words/3_GET" => [
|
336
|
+
[0] {
|
337
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/words/3_GET",
|
338
|
+
:data => 0.286
|
339
|
+
},
|
340
|
+
[1] {
|
341
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/words/3_GET",
|
342
|
+
:data => 0.671
|
343
|
+
}
|
344
|
+
],
|
345
|
+
"Munishs-MacBook-Pro.local_/words/2_GET" => [
|
346
|
+
[0] {
|
347
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/words/2_GET",
|
348
|
+
:data => 0.458
|
349
|
+
}
|
350
|
+
],
|
351
|
+
"Munishs-MacBook-Pro.local_/words/1/ajax_promote_flag_GET" => [
|
352
|
+
[0] {
|
353
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/words/1/ajax_promote_flag_GET",
|
354
|
+
:data => 0.095
|
355
|
+
}
|
356
|
+
],
|
357
|
+
"Munishs-MacBook-Pro.local_/users_GET" => [
|
358
|
+
[0] {
|
359
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/users_GET",
|
360
|
+
:data => 0.603
|
361
|
+
},
|
362
|
+
[1] {
|
363
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/users_GET",
|
364
|
+
:data => 0.319
|
365
|
+
},
|
366
|
+
[2] {
|
367
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/users_GET",
|
368
|
+
:data => 0.288
|
369
|
+
}
|
370
|
+
],
|
371
|
+
"Munishs-MacBook-Pro.local_/generals/2_GET" => [
|
372
|
+
[0] {
|
373
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/generals/2_GET",
|
374
|
+
:data => 0.431
|
375
|
+
}
|
376
|
+
],
|
377
|
+
"Munishs-MacBook-Pro.local_/flags_GET" => [
|
378
|
+
[0] {
|
379
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/flags_GET",
|
380
|
+
:data => 0.582
|
381
|
+
}
|
382
|
+
],
|
383
|
+
"Munishs-MacBook-Pro.local_/dictionaries_GET" => [
|
384
|
+
[0] {
|
385
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/dictionaries_GET",
|
386
|
+
:data => 0.397
|
387
|
+
}
|
388
|
+
],
|
389
|
+
"Munishs-MacBook-Pro.local_/admins/1_GET" => [
|
390
|
+
[0] {
|
391
|
+
:server_plus_api => "Munishs-MacBook-Pro.local_/admins/1_GET",
|
392
|
+
:data => 0.343
|
393
|
+
}
|
394
|
+
]
|
395
|
+
},
|
396
|
+
:start_time => 2017-12-02 22:33:38 UTC,
|
397
|
+
:end_time => 2017-12-03 04:33:38 UTC
|
398
|
+
}
|
399
|
+
]
|
400
|
+
|
83
401
|
ReqResStat.get_details(:max_time, t - 2.day, t, :max, 6.hours)
|
84
402
|
ReqResStat.get_details(:max_time, t - 2.day, t, :min, 6.hours)
|
85
403
|
ReqResStat.get_details(:max_time, t - 2.day, t, :sum, 6.hours)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module RequestResponseStats
|
2
|
+
module Generators
|
3
|
+
class CustomizationGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../../templates', __FILE__)
|
5
|
+
|
6
|
+
desc "Create RequestResponseStats configuration files"
|
7
|
+
|
8
|
+
def copy_customization_files
|
9
|
+
files_to_generate = [
|
10
|
+
"config/initializers/request_response_stats_config.rb",
|
11
|
+
"app/controllers/req_res_stat_controller.rb",
|
12
|
+
"lib/tasks/move_req_res_cycle_data_from_redis_to_mongo.rake"
|
13
|
+
]
|
14
|
+
files_to_generate.each do |file|
|
15
|
+
just_file_name = file.split("/")[-1]
|
16
|
+
copy_file just_file_name, file
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
File without changes
|
File without changes
|
data/lib/{request_response_stats_config.rb → generators/templates/request_response_stats_config.rb}
RENAMED
@@ -30,6 +30,11 @@ end
|
|
30
30
|
# end
|
31
31
|
# end
|
32
32
|
|
33
|
+
|
34
|
+
# Note: Below block is commented out with `=begin` and `=end`
|
35
|
+
# You can uncomment the clients that are used in your application
|
36
|
+
|
37
|
+
=begin
|
33
38
|
# Configure popular REST and SOAP libraries
|
34
39
|
# Client libraries
|
35
40
|
require 'rest-client'
|
@@ -62,3 +67,4 @@ module Savon
|
|
62
67
|
end
|
63
68
|
end
|
64
69
|
end
|
70
|
+
=end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: request_response_stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Munish Goyal
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -126,7 +126,10 @@ files:
|
|
126
126
|
- Rakefile
|
127
127
|
- bin/console
|
128
128
|
- bin/setup
|
129
|
-
- lib/
|
129
|
+
- lib/generators/request_response_stats/customization_generator.rb
|
130
|
+
- lib/generators/templates/move_req_res_cycle_data_from_redis_to_mongo.rake
|
131
|
+
- lib/generators/templates/req_res_stat_controller.rb
|
132
|
+
- lib/generators/templates/request_response_stats_config.rb
|
130
133
|
- lib/request_response_stats.rb
|
131
134
|
- lib/request_response_stats/controller_concern.rb
|
132
135
|
- lib/request_response_stats/custom_client.rb
|
@@ -136,8 +139,6 @@ files:
|
|
136
139
|
- lib/request_response_stats/req_res_stat.rb
|
137
140
|
- lib/request_response_stats/request_response.rb
|
138
141
|
- lib/request_response_stats/version.rb
|
139
|
-
- lib/request_response_stats_config.rb
|
140
|
-
- lib/tasks/move_req_res_cycle_data_from_redis_to_mongo.rake
|
141
142
|
- request_response_stats.gemspec
|
142
143
|
homepage: https://github.com/goyalmunish/request_response_stats
|
143
144
|
licenses:
|