rorvswild 1.4.3 → 1.4.4

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: 0f23e21192cda1d56b1637aba574353a08337b13
4
- data.tar.gz: f9381d9f832aa58610ae81ee948c9ec56acd6783
3
+ metadata.gz: 171608a472bba02aca22c38a5ef435ed30f7de99
4
+ data.tar.gz: e3e0b6d5583d165c411cd9dfc437b5916a61f798
5
5
  SHA512:
6
- metadata.gz: afdc87336f00fe3077bf0a442bf15e2db8961277cc7ebaaee3d2485f98e625d5f3bc37e6cebde1d9b616bf7644ecd58099997d641a17590689d92c84fc0bac8a
7
- data.tar.gz: 87c51a91e102a8b8a34d09a5abd8b40660790524c5ca757972848db1df7e0579ac2657842d688c5d788ef15f0633e1dfabacd621cd04e382fbc57dac3f5ee7f9
6
+ metadata.gz: 66c87f4cd4eab22ece86273ec9ec1c8e0666410bb9312d0ed1e93ff87f339e61e6a261dacfb4056feb40a45b0ee1bc26d0ace366c41bc16b7f05df858d508a50
7
+ data.tar.gz: c636eda87ef43cf16a3f9e45e6d07f52c06506cd3040889cdac0ed1f360e9afebe614acd880f6b3593ba487bf5b858928344502f89aafdc191fc8fddb4af75be
data/README.md CHANGED
@@ -120,30 +120,51 @@ RorVsWild.record_error(exception, {something: "important"})
120
120
  RorVsWild.catch_error(something: "important") { 1 / 0 }
121
121
  ```
122
122
 
123
- #### Ignore endpoints and exceptions
123
+ #### Ignore requests, jobs, exceptions and plugins
124
124
 
125
- By using `ignore_actions` you can prevent from tracking specific endpoints. In the same idea you can prevent from recording specific exceptions with the `ignore_exceptions` config.
125
+ From the configuration file, you can tell RorVsWild to skip monitoring some requests, jobs, exceptions and plugins.
126
126
 
127
127
  ```yaml
128
128
  # config/rorvswild.yml
129
129
  production:
130
130
  api_key: API_KEY
131
- ignore_actions:
131
+ ignore_requests:
132
132
  - SecretController#index
133
+ ignore_jobs:
134
+ - SecretJob
133
135
  ignore_exceptions:
134
- - ActionController::RoutingError
136
+ - ActionController::RoutingError # Ignore by default any 404
135
137
  - ZeroDivisionError
138
+ ignore_plugins:
139
+ - Sidekiq # If you don't want to monitor your Sidekiq jobs
136
140
  ```
137
141
 
142
+ Here is the equivalent if you prefer initializing RorVsWild manually.
143
+
138
144
  ```ruby
139
145
  # config/initializers/rorvswild.rb
140
146
  RorVsWild.start(
141
147
  api_key: "API_KEY",
142
- ignore_actions: ["SecretController#index"],
143
- ignore_exceptions: ["ActionController::RoutingError", "ZeroDivisionError"])
148
+ ignore_requests: ["SecretController#index"],
149
+ ignore_jobs: ["SecretJob"],
150
+ ignore_exceptions: ["ActionController::RoutingError", "ZeroDivisionError"],
151
+ ignore_plugins: ["Sidekiq"])
144
152
  ```
145
153
 
146
- By default ActionController::RoutingError is ignored in order to not be flooded with 404.
154
+ Finnally here is the list of all plugins that you can ignore :
155
+
156
+ - ActionController
157
+ - ActionMailer
158
+ - ActionView
159
+ - ActiveJob
160
+ - ActiveRecord
161
+ - DelayedJob
162
+ - Elasticsearch
163
+ - Mongo
164
+ - NetHttp
165
+ - Redis
166
+ - Resque
167
+ - Sidekiq
147
168
 
148
169
  ## Contributing
149
170
 
@@ -8,7 +8,9 @@ module RorVsWild
8
8
  {
9
9
  api_url: "https://www.rorvswild.com/api/v1",
10
10
  ignore_exceptions: default_ignored_exceptions,
11
- ignore_actions: [],
11
+ ignore_requests: [],
12
+ ignore_plugins: [],
13
+ ignore_jobs: [],
12
14
  }
13
15
  end
14
16
 
@@ -37,21 +39,13 @@ module RorVsWild
37
39
  end
38
40
 
39
41
  def setup_plugins
40
- Plugin::NetHttp.setup
41
-
42
- Plugin::Redis.setup
43
- Plugin::Mongo.setup
44
- Plugin::Elasticsearch.setup
45
-
46
- Plugin::Resque.setup
47
- Plugin::Sidekiq.setup
48
- Plugin::ActiveJob.setup
49
- Plugin::DelayedJob.setup
50
-
51
- Plugin::ActionView.setup
52
- Plugin::ActiveRecord.setup
53
- Plugin::ActionMailer.setup
54
- Plugin::ActionController.setup
42
+ for name in RorVsWild::Plugin.constants
43
+ next if config[:ignore_plugins] && config[:ignore_plugins].include?(name.to_s)
44
+ if (plugin = RorVsWild::Plugin.const_get(name)).respond_to?(:setup)
45
+ RorVsWild.logger.info("Load plugin #{name}")
46
+ plugin.setup
47
+ end
48
+ end
55
49
  end
56
50
 
57
51
  def measure_code(code)
@@ -77,7 +71,8 @@ module RorVsWild
77
71
  end
78
72
 
79
73
  def measure_job(name, parameters: nil, &block)
80
- return block.call if data[:name] # Prevent from recursive jobs
74
+ return measure_section(name, &block) if data[:name] # For recursive jobs
75
+ return block.call if ignored_job?(name)
81
76
  initialize_data(name)
82
77
  begin
83
78
  block.call
@@ -135,8 +130,12 @@ module RorVsWild
135
130
  end
136
131
  end
137
132
 
138
- def ignored_action?(name)
139
- config[:ignore_actions].include?(name)
133
+ def ignored_request?(name)
134
+ (config[:ignore_actions] || config[:ignore_requests]).include?(name)
135
+ end
136
+
137
+ def ignored_job?(name)
138
+ config[:ignore_jobs].include?(name)
140
139
  end
141
140
 
142
141
  #######################
@@ -7,7 +7,7 @@ module RorVsWild
7
7
  class Client
8
8
  HTTPS = "https".freeze
9
9
  CERTIFICATE_AUTHORITIES_PATH = File.expand_path("../../../cacert.pem", __FILE__)
10
- DEFAULT_TIMEOUT = 1
10
+ DEFAULT_TIMEOUT = 3
11
11
 
12
12
  attr_reader :api_url, :api_key, :timeout, :threads
13
13
 
@@ -19,10 +19,25 @@ module RorVsWild
19
19
  <<YAML
20
20
  production:
21
21
  api_key: #{api_key}
22
- # ignore_actions: # Do not track following endpoints
22
+ # ignore_requests: # Do not monitor the following actions
23
23
  # - SecretController#index
24
- # ignore_exceptions: # Do not track following exceptions
25
- # - ActionController::RoutingError
24
+ # ignore_jobs: # Do not monitor the following jobs
25
+ # - SecretJob
26
+ # ignore_exceptions: # Do not record the following exceptions
27
+ # - ActionController::RoutingError # By default to ignore 404
28
+ # ignore_plugins:
29
+ # - ActionController
30
+ # - ActionMailer
31
+ # - ActionView
32
+ # - ActiveJob
33
+ # - ActiveRecord
34
+ # - DelayedJob
35
+ # - Elasticsearch
36
+ # - Mongo
37
+ # - NetHttp
38
+ # - Redis
39
+ # - Resque
40
+ # - Sidekiq
26
41
  YAML
27
42
  end
28
43
  end
@@ -35,7 +35,7 @@ module RorVsWild
35
35
 
36
36
  # Payload: controller, action, params, format, method, path
37
37
  def start(name, id, payload)
38
- if !RorVsWild.agent.ignored_action?(name = "#{payload[:controller]}##{payload[:action]}")
38
+ if !RorVsWild.agent.ignored_request?(name = "#{payload[:controller]}##{payload[:action]}")
39
39
  RorVsWild.agent.start_request(name: name, path: payload[:path])
40
40
  end
41
41
  end
@@ -1,15 +1 @@
1
- require "rorvswild/plugin/net_http"
2
-
3
- require "rorvswild/plugin/redis"
4
- require "rorvswild/plugin/mongo"
5
- require "rorvswild/plugin/elasticsearch"
6
-
7
- require "rorvswild/plugin/resque"
8
- require "rorvswild/plugin/sidekiq"
9
- require "rorvswild/plugin/active_job"
10
- require "rorvswild/plugin/delayed_job"
11
-
12
- require "rorvswild/plugin/action_view"
13
- require "rorvswild/plugin/active_record"
14
- require "rorvswild/plugin/action_mailer"
15
- require "rorvswild/plugin/action_controller"
1
+ Dir[File.dirname(__FILE__) + "/plugin/*.rb"].each { |path| require path }
@@ -1,3 +1,3 @@
1
1
  module RorVsWild
2
- VERSION = "1.4.3".freeze
2
+ VERSION = "1.4.4".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rorvswild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Bernard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-11 00:00:00.000000000 Z
11
+ date: 2019-08-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Performances and quality insights for rails developers.
14
14
  email: