rorvswild 1.3.5 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -4
- data/lib/rorvswild/agent.rb +20 -15
- data/lib/rorvswild/installer.rb +4 -3
- data/lib/rorvswild/local/middleware.rb +7 -2
- data/lib/rorvswild/plugin/action_controller.rb +3 -2
- data/lib/rorvswild/plugin/elasticsearch.rb +3 -3
- data/lib/rorvswild/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 866713e4d2ad9b6e923ad8c3f79956191003b5b3
|
4
|
+
data.tar.gz: 4e9cc4c5fb4aab0b795775ecf169263f5ceec711
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d4b4e2f4e07bb9a60e57a5761ee3bc0673131a259b6feec00df78291eb06d2279da5badced799861eb7c40188daa91c6a3a97a3de0bde3777fbcd0aaa4cc74e
|
7
|
+
data.tar.gz: d6a7be8a7e745141cd7681455aadfe695c290bedb73ef1644552684a3f6845037ad66b18932fdf042444802bda498f2f85c247bdd476971f452a478f02e91420
|
data/README.md
CHANGED
@@ -120,15 +120,17 @@ RorVsWild.record_error(exception, {something: "important"})
|
|
120
120
|
RorVsWild.catch_error(something: "important") { 1 / 0 }
|
121
121
|
```
|
122
122
|
|
123
|
-
#### Ignore exceptions
|
123
|
+
#### Ignore endpoints and exceptions
|
124
124
|
|
125
|
-
By using the
|
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.
|
126
126
|
|
127
127
|
```yaml
|
128
128
|
# config/rorvswild.yml
|
129
129
|
production:
|
130
130
|
api_key: API_KEY
|
131
|
-
|
131
|
+
ignore_actions:
|
132
|
+
- SecretController#index
|
133
|
+
ignore_exceptions:
|
132
134
|
- ActionController::RoutingError
|
133
135
|
- ZeroDivisionError
|
134
136
|
```
|
@@ -137,7 +139,8 @@ production:
|
|
137
139
|
# config/initializers/rorvswild.rb
|
138
140
|
RorVsWild.start(
|
139
141
|
api_key: "API_KEY",
|
140
|
-
|
142
|
+
ignore_actions: ["SecretController#index"],
|
143
|
+
ignore_exceptions: ["ActionController::RoutingError", "ZeroDivisionError"])
|
141
144
|
```
|
142
145
|
|
143
146
|
By default ActionController::RoutingError is ignored in order to not be flooded with 404.
|
data/lib/rorvswild/agent.rb
CHANGED
@@ -7,32 +7,33 @@ module RorVsWild
|
|
7
7
|
def self.default_config
|
8
8
|
{
|
9
9
|
api_url: "https://www.rorvswild.com/api/v1",
|
10
|
-
|
10
|
+
ignore_exceptions: default_ignored_exceptions,
|
11
|
+
ignore_actions: [],
|
11
12
|
}
|
12
13
|
end
|
13
14
|
|
14
|
-
|
15
|
+
def self.default_ignored_exceptions
|
16
|
+
if defined?(Rails)
|
17
|
+
%w[ActionController::RoutingError] + Rails.application.config.action_dispatch.rescue_responses.map { |(key,value)| key }
|
18
|
+
else
|
19
|
+
[]
|
20
|
+
end
|
21
|
+
end
|
15
22
|
|
16
|
-
attr_reader :app_root_regex, :client, :queue
|
23
|
+
attr_reader :config, :app_root, :app_root_regex, :client, :queue
|
17
24
|
|
18
25
|
def initialize(config)
|
19
|
-
config = self.class.default_config.merge(config)
|
20
|
-
@
|
21
|
-
@app_root = config[:app_root]
|
22
|
-
@client = Client.new(config)
|
26
|
+
@config = self.class.default_config.merge(config)
|
27
|
+
@client = Client.new(@config)
|
23
28
|
@queue = config[:queue] || Queue.new(client)
|
24
|
-
cleanup_data
|
25
|
-
|
26
|
-
if defined?(Rails)
|
27
|
-
@app_root ||= Rails.root.to_s
|
28
|
-
config = Rails.application.config
|
29
|
-
@ignored_exceptions ||= %w[ActionController::RoutingError] + config.action_dispatch.rescue_responses.map { |(key,value)| key }
|
30
|
-
end
|
31
29
|
|
30
|
+
@app_root = config[:app_root]
|
31
|
+
@app_root ||= Rails.root.to_s if defined?(Rails)
|
32
32
|
@app_root_regex = app_root ? /\A#{app_root}/ : nil
|
33
33
|
|
34
34
|
RorVsWild.logger.info("Start RorVsWild #{RorVsWild::VERSION} from #{app_root}")
|
35
35
|
setup_plugins
|
36
|
+
cleanup_data
|
36
37
|
end
|
37
38
|
|
38
39
|
def setup_plugins
|
@@ -134,6 +135,10 @@ module RorVsWild
|
|
134
135
|
end
|
135
136
|
end
|
136
137
|
|
138
|
+
def ignored_action?(name)
|
139
|
+
config[:ignore_actions].include?(name)
|
140
|
+
end
|
141
|
+
|
137
142
|
#######################
|
138
143
|
### Private methods ###
|
139
144
|
#######################
|
@@ -178,7 +183,7 @@ module RorVsWild
|
|
178
183
|
end
|
179
184
|
|
180
185
|
def ignored_exception?(exception)
|
181
|
-
ignored_exceptions.include?(exception.class.to_s)
|
186
|
+
(config[:ignored_exceptions] || config[:ignore_exceptions]).include?(exception.class.to_s)
|
182
187
|
end
|
183
188
|
end
|
184
189
|
end
|
data/lib/rorvswild/installer.rb
CHANGED
@@ -19,9 +19,10 @@ module RorVsWild
|
|
19
19
|
<<YAML
|
20
20
|
production:
|
21
21
|
api_key: #{api_key}
|
22
|
-
#
|
23
|
-
|
24
|
-
#
|
22
|
+
ignore_actions: # Do not track following endpoints
|
23
|
+
# - SecretController#index
|
24
|
+
ignore_exceptions: # Do not track following exceptions
|
25
|
+
# - ActionController::RoutingError
|
25
26
|
YAML
|
26
27
|
end
|
27
28
|
end
|
@@ -14,8 +14,8 @@ module RorVsWild
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def standalone_profiler(env)
|
17
|
-
html =
|
18
|
-
[200, {"Content-Type:" => "text/html; charset=utf-8"}, StringIO.new(
|
17
|
+
html = inject_into(empty_html_page)
|
18
|
+
[200, {"Content-Type:" => "text/html; charset=utf-8"}, StringIO.new(html || empty_html_page)]
|
19
19
|
end
|
20
20
|
|
21
21
|
def embed_profiler(env)
|
@@ -44,6 +44,7 @@ module RorVsWild
|
|
44
44
|
html
|
45
45
|
rescue Encoding::UndefinedConversionError => ex
|
46
46
|
log_incompatible_encoding_warning(ex)
|
47
|
+
nil
|
47
48
|
end
|
48
49
|
|
49
50
|
LOCAL_FOLDER = File.expand_path(File.dirname(__FILE__))
|
@@ -69,6 +70,10 @@ module RorVsWild
|
|
69
70
|
files.map { |file| File.read(File.join(directory, file)) }.join("\n")
|
70
71
|
end
|
71
72
|
|
73
|
+
def empty_html_page
|
74
|
+
"<!DOCTYPE html>\n<html><head></head><body></body></html>"
|
75
|
+
end
|
76
|
+
|
72
77
|
def log_incompatible_middleware_warning
|
73
78
|
RorVsWild.logger.warn("RorVsWild::Local cannot be embeded into your HTML page because of compression." +
|
74
79
|
" Try to disable Rack::Deflater in development only." +
|
@@ -35,8 +35,9 @@ module RorVsWild
|
|
35
35
|
|
36
36
|
# Payload: controller, action, params, format, method, path
|
37
37
|
def start(name, id, payload)
|
38
|
-
name = "#{payload[:controller]}##{payload[:action]}"
|
39
|
-
|
38
|
+
if !RorVsWild.agent.ignored_action?(name = "#{payload[:controller]}##{payload[:action]}")
|
39
|
+
RorVsWild.agent.start_request(name: name, path: payload[:path])
|
40
|
+
end
|
40
41
|
end
|
41
42
|
|
42
43
|
def finish(name, id, payload)
|
@@ -8,11 +8,11 @@ module RorVsWild
|
|
8
8
|
::Elasticsearch::Transport::Client.class_eval do
|
9
9
|
alias_method :perform_request_without_rorvswild, :perform_request
|
10
10
|
|
11
|
-
def perform_request(
|
11
|
+
def perform_request(*args)
|
12
12
|
RorVsWild::Plugin::NetHttp.ignore do
|
13
|
-
command = {method:
|
13
|
+
command = {method: args[0], path: args[1], params: args[2], body: args[3]}.to_json
|
14
14
|
RorVsWild.agent.measure_section(command, kind: "elasticsearch") do
|
15
|
-
perform_request_without_rorvswild(
|
15
|
+
perform_request_without_rorvswild(*args)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/lib/rorvswild/version.rb
CHANGED
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
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Bernard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Performances and quality insights for rails developers.
|
14
14
|
email:
|