request_response_stats 0.1.1 → 0.1.2

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: 1d93ef2e0bb7c1e31551811923a3b6393721c46f
4
- data.tar.gz: a411d96d3df46bbd8832332d23a8dc469371d65b
3
+ metadata.gz: 7ec5e280b0e51eea96f32ff6cc394465f2842e47
4
+ data.tar.gz: e7251233787d35459ca4ca406dbc27f025ce659f
5
5
  SHA512:
6
- metadata.gz: d407ec5d98944bdc216d91bbb34e1bdf8af27eb56ead08a11f1e45253bb59415bc1b08f3e943c8ca5fff04eead3671dfa9ea968c81ba3bc60aa191508648cde4
7
- data.tar.gz: 6723271a4816804f5d4d660a5492b57f3f1bde43e53835f15ef33623adc79af9f9b0292002836591dbdadb85b2176545bdcbfd22f47d0eb946851bca56edb109
6
+ metadata.gz: e10ffcbf9cd5a480b2d56c2ffa559bd77d901b918a1552137e41062ca90b80f4f5bb3079fb356d5e9e280beb5beee0d11108b1a035e8ca3a934ec61310e3810c
7
+ data.tar.gz: fda1bb50c99e615b02e3eff343bc66dc49f72affc44c1e53d39bfe0da50bdbbb7b02b47ab96d55098d9e50cb0262817b68acbae46662c97d97667874619d85c0
data/README.md CHANGED
@@ -1,12 +1,8 @@
1
1
  # RequestResponseStats
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/request_response_stats`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
3
  ## Installation
8
4
 
9
- Add this line to your application's Gemfile:
5
+ Add gem to your application's Gemfile:
10
6
 
11
7
  ```ruby
12
8
  gem 'request_response_stats'
@@ -14,15 +10,81 @@ gem 'request_response_stats'
14
10
 
15
11
  And then execute:
16
12
 
17
- $ bundle
13
+ ```bash
14
+ $ bundle install
15
+ ```
16
+
17
+ Or install it separately as:
18
18
 
19
- Or install it yourself as:
19
+ ```bash
20
+ $ gem install request_response_stats
21
+ ```
22
+
23
+ Add following to the controller whose request response stats are to be captured. For example,
20
24
 
21
- $ gem install request_response_stats
25
+ ```ruby
26
+ class ApplicationController < ActionController::Base
27
+ include RequestResponseStats::ControllerConcern
28
+ # rest of the code
29
+ end
30
+ ```
31
+
32
+ Right now there are some manual tasks:
33
+
34
+ - Copy file `lib/req_res_stat_controller.rb` from gem to `app/controllers/req_res_stat_controller.rb` within Rails app.
35
+ - Copy file `lib/request_response_stats_config.rb` from gem to `config/initializers/request_response_stat_config.rb` within Rails app
36
+ - Copy file `lib/tasks/move_req_res_cycle_data_from_redis_to_mongo.rake` from gem to `lib/tasks/move_req_res_cycle_data_from_redis_to_mongo.rake` within Rails app.
37
+
38
+ TODO: Write rake task for this.
22
39
 
23
40
  ## Usage
24
41
 
25
- TODO: Write usage instructions here
42
+ ### Documentation References
43
+
44
+ http://www.rubydoc.info/gems/request_response_stats/
45
+
46
+ You can get better documentation by running tests.
47
+
48
+ TODO: Include examples for below commands.
49
+
50
+ ### Checking current data in redis
51
+
52
+ ```ruby
53
+ # include RequestResponseStats
54
+ rrs = RequestResponse.new(nil, nil)
55
+ rrs.redis_record.hashify_all_data.size
56
+ rrs.redis_record.hashify_all_data
57
+ ```
58
+
59
+ ### Manually moving data from Redis to Mongo
60
+
61
+ ```ruby
62
+ rrs.move_data_from_redis_to_mongo
63
+ ```
64
+ Note: To automate use: lib/tasks/move_req_res_cycle_data_from_redis_to_mongo.rake
65
+
66
+ ### Deleting data from Redis and Mongo
67
+
68
+ ```ruby
69
+ rrs.redis_record.all_keys.each{|k| rrs.redis_record.del k}
70
+ ReqResStat.all.delete_all
71
+ ```
72
+
73
+ ### Getting stats from Mongo
74
+
75
+ ```ruby
76
+ ReqResStat.all.size
77
+ ReqResStat.all.first
78
+ t = Time.now
79
+ ReqResStat.get_max(:max_time, t - 2.day, t, 6.hours).map{|r| r[:data]}
80
+ ReqResStat.get_avg(:avg_time, t - 2.day, t, 6.hours).map{|r| r[:data]}
81
+ ReqResStat.get_max(:min_time, t - 2.day, t, 6.hours).map{|r| r[:data]}
82
+ ReqResStat.get_details(:max_time, t - 2.day, t, nil, 6.hours)
83
+ ReqResStat.get_details(:max_time, t - 2.day, t, :max, 6.hours)
84
+ ReqResStat.get_details(:max_time, t - 2.day, t, :min, 6.hours)
85
+ ReqResStat.get_details(:max_time, t - 2.day, t, :sum, 6.hours)
86
+ ReqResStat.get_details(:max_time, t - 2.day, t, :avg, 6.hours)
87
+ ```
26
88
 
27
89
  ## Development
28
90
 
@@ -32,7 +94,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
94
 
33
95
  ## Contributing
34
96
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/request_response_stats. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
97
+ Bug reports and pull requests are welcome on GitHub at https://github.com/goyalmunish/request_response_stats. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
98
 
37
99
  ## License
38
100
 
@@ -40,4 +102,4 @@ The gem is available as open source under the terms of the [MIT License](http://
40
102
 
41
103
  ## Code of Conduct
42
104
 
43
- Everyone interacting in the RequestResponseStats project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/request_response_stats/blob/master/CODE_OF_CONDUCT.md).
105
+ Everyone interacting in the RequestResponseStats project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/goyalmunish/request_response_stats/blob/master/CODE_OF_CONDUCT.md).
@@ -21,42 +21,3 @@ module RequestResponseStats
21
21
  end
22
22
  end
23
23
  end
24
-
25
- # TODO: The following files should not be required like this, instead they should be extracted into correct
26
- # place in Rails project using `rake` command
27
- # require_relative 'req_res_stat_controller'
28
- # require_relative 'request_response_stats_config'
29
-
30
- ##### Examples: #####
31
-
32
- ## Checking current redis data:
33
- =begin
34
- # require 'request_response_stats'
35
- include RequestResponseStats
36
- rrs = RequestResponse.new(nil, nil)
37
- ap rrs.redis_record.hashify_all_data
38
- ap rrs.redis_record.hashify_all_data.size
39
- =end
40
-
41
- ## Manually moving data from Redis to Mongo:
42
- # ap rrs.move_data_from_redis_to_mongo
43
-
44
- ## Deleting data from Redis and Mongo:
45
- # rrs.redis_record.all_keys.each{|k| rrs.redis_record.del k}
46
- # ReqResStat.all.delete_all
47
-
48
- ## Getting stats from Mongo:
49
- =begin
50
- ap ReqResStat.all.size
51
- ap ReqResStat.all.first
52
- t = Time.now
53
- ReqResStat.get_max(:max_time, t - 2.day, t, 6.hours).map{|r| r[:data]}
54
- ReqResStat.get_avg(:avg_time, t - 2.day, t, 6.hours).map{|r| r[:data]}
55
- ReqResStat.get_max(:min_time, t - 2.day, t, 6.hours).map{|r| r[:data]}
56
- ap ReqResStat.get_details(:max_time, t - 2.day, t, nil, 6.hours)
57
- ap ReqResStat.get_details(:max_time, t - 2.day, t, :max, 6.hours)
58
- ap ReqResStat.get_details(:max_time, t - 2.day, t, :min, 6.hours)
59
- ap ReqResStat.get_details(:max_time, t - 2.day, t, :sum, 6.hours)
60
- ap ReqResStat.get_details(:max_time, t - 2.day, t, :avg, 6.hours)
61
- =end
62
-
@@ -1,5 +1,5 @@
1
1
  # File: lib/request_response_stats/version.rb
2
2
 
3
3
  module RequestResponseStats
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
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.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Munish Goyal