request_response_stats 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0bde5823cb6c377d0f0544a0efb22523aa6758f7
4
- data.tar.gz: 14d4ed2106fa3dd22dfcd225121fdf1efc95bbcf
3
+ metadata.gz: df56081c132cf711319a1a06beaa87a04815af8b
4
+ data.tar.gz: 3cd442829c9c12d7f0390ab2199dedd7392bb5b4
5
5
  SHA512:
6
- metadata.gz: 76c678ce28f903ee6a8badfe44e94cff931346ca0cb24ba44203fe17917bcfb4ee2510ba478f6f08ed39875f45e4e58c97d81298ecff8c9b3ba8cbaa57d789e6
7
- data.tar.gz: 610074ebd7f4e68aae4854d492a04b8c59dff454cf0ac4ae6d050a238e738bf56dba6187f970ade1502f60194cb36fbaab4be3ec703e8ca78de37ed234f21e70
6
+ metadata.gz: 2abcebce918f49f31e6186ff78b5b49b25b62f1ff8c344ac2beb0c1c22fdebfaea015fe9eea8b4e9931335c481b2f248a0111cbc516db17a2eac7c676f27fd47
7
+ data.tar.gz: a0343daad08c6920998efead55aed23138adb361f835a8df1276c71dde78eeda73269c8787b215d79f6f37f1d68e1966570ab2eb45e90a5f323cc71c783b1e2f
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  - [RequestResponseStats](#requestresponsestats)
6
6
  - [Prerequisites](#prerequisites)
7
- - [Installation](#installation)
7
+ - [Installation and Setup](#installation-and-setup)
8
8
  - [Usage](#usage)
9
9
  - [Documentation References](#documentation-references)
10
10
  - [Checking current data in redis](#checking-current-data-in-redis)
@@ -24,9 +24,9 @@
24
24
 
25
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
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`.
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`) through `RequestResponseStats::RequestResponse.new`.
28
28
 
29
- ## Installation
29
+ ## Installation and Setup
30
30
 
31
31
  Add gem to your application's Gemfile:
32
32
 
@@ -46,7 +46,7 @@ Or install it separately as:
46
46
  $ gem install request_response_stats
47
47
  ```
48
48
 
49
- Add following to the controller whose request response stats are to be captured. For example,
49
+ Include `RequestResponseStats::ControllerConcern` to the controller whose request response stats are to be captured. For example,
50
50
 
51
51
  ```ruby
52
52
  class ApplicationController < ActionController::Base
@@ -212,16 +212,15 @@ rrs.redis_record.hashify_all_data["api_req_res_PUBLIC_Munishs-MacBook-Pro.local_
212
212
  "oldmalloc_increase_bytes_limit" => 0
213
213
  }
214
214
  }
215
- => nil
216
215
  ```
217
216
 
218
217
  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
218
 
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`.
219
+ 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 configurations in`request_response_stats_config.rb`.
221
220
 
222
221
  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
222
 
224
- For example,
223
+ For example, consider the key `"api_req_res_PUBLIC_Munishs-MacBook-Pro.local_/words/1/ajax_promote_flag_GET_2017-12-03-0202"`:
225
224
 
226
225
  ```ruby
227
226
  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"
@@ -236,11 +235,10 @@ This means that the server `Munishs-MacBook-Pro.local` received `3` (as reported
236
235
 
237
236
  ### Manually moving data from Redis to Mongo
238
237
 
239
- Moving freezed, non-support keys from Redis to Mongo:
238
+ Moving only request_response_stats specific, freezed, non-support (that is `{support: false}`) keys from Redis to Mongo:
240
239
 
241
240
  ```ruby
242
- rrs.move_data_from_redis_to_mongo
243
- # => 16
241
+ rrs.move_data_from_redis_to_mongo # => 16
244
242
  ```
245
243
 
246
244
  Note: Make use of `lib/tasks/move_req_res_cycle_data_from_redis_to_mongo.rake` to schedule this task using cron.
@@ -2,8 +2,7 @@ module RequestResponseStats
2
2
  module Generators
3
3
  class CustomizationGenerator < Rails::Generators::Base
4
4
  source_root File.expand_path('../../templates', __FILE__)
5
-
6
- desc "Create RequestResponseStats configuration files"
5
+ desc "Create RequestResponseStats customization files"
7
6
 
8
7
  def copy_customization_files
9
8
  files_to_generate = [
@@ -12,6 +11,7 @@ module RequestResponseStats
12
11
  "lib/tasks/move_req_res_cycle_data_from_redis_to_mongo.rake"
13
12
  ]
14
13
  files_to_generate.each do |file|
14
+ puts "Generating #{file}.."
15
15
  just_file_name = file.split("/")[-1]
16
16
  copy_file just_file_name, file
17
17
  end
@@ -1,5 +1,5 @@
1
1
  # File: lib/request_response_stats/version.rb
2
2
 
3
3
  module RequestResponseStats
4
- VERSION = "0.1.3"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: request_response_stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Munish Goyal