raygun4ruby 3.2.6 → 4.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +48 -0
- data/.gitignore +22 -21
- data/.rspec +1 -1
- data/Appraisals +19 -0
- data/CHANGELOG.md +169 -133
- data/Gemfile +4 -4
- data/LICENSE.txt +22 -22
- data/README.md +424 -420
- data/Rakefile +32 -27
- data/examples/sinatras_raygun.rb +17 -17
- data/gemfiles/rails_6.gemfile +9 -0
- data/gemfiles/rails_7.gemfile +10 -0
- data/gemfiles/rails_7_sidekiq_6.gemfile +10 -0
- data/lib/generators/raygun/install_generator.rb +26 -26
- data/lib/raygun/affected_user.rb +59 -59
- data/lib/raygun/breadcrumbs/breadcrumb.rb +34 -34
- data/lib/raygun/breadcrumbs/store.rb +86 -86
- data/lib/raygun/breadcrumbs.rb +34 -34
- data/lib/raygun/client.rb +313 -308
- data/lib/raygun/configuration.rb +197 -194
- data/lib/raygun/demo_exception.rb +22 -22
- data/lib/raygun/error.rb +10 -10
- data/lib/raygun/error_subscriber.rb +21 -0
- data/lib/raygun/javascript_tracker.rb +42 -42
- data/lib/raygun/middleware/breadcrumbs_store_initializer.rb +19 -19
- data/lib/raygun/middleware/javascript_exception_tracking.rb +40 -32
- data/lib/raygun/middleware/rack_exception_interceptor.rb +18 -18
- data/lib/raygun/middleware/rails_insert_affected_user.rb +26 -26
- data/lib/raygun/railtie.rb +47 -39
- data/lib/raygun/services/apply_whitelist_filter_to_payload.rb +27 -27
- data/lib/raygun/sidekiq.rb +51 -71
- data/lib/raygun/version.rb +3 -3
- data/lib/raygun.rb +197 -179
- data/lib/raygun4ruby.rb +1 -1
- data/lib/resque/failure/raygun.rb +25 -25
- data/lib/tasks/raygun.tasks +7 -7
- data/raygun4ruby.gemspec +43 -45
- data/spec/features/javascript_spec.rb +48 -48
- data/spec/rails_applications/6.1.4/Gemfile +56 -0
- data/spec/{dummy/README.rdoc → rails_applications/6.1.4/README.md} +24 -28
- data/spec/{dummy → rails_applications/6.1.4}/Rakefile +6 -6
- data/spec/rails_applications/6.1.4/app/assets/config/manifest.js +2 -0
- data/spec/{dummy → rails_applications/6.1.4}/app/assets/images/.keep +0 -0
- data/spec/{dummy → rails_applications/6.1.4}/app/assets/stylesheets/application.css +15 -15
- data/spec/rails_applications/6.1.4/app/channels/application_cable/channel.rb +4 -0
- data/spec/rails_applications/6.1.4/app/channels/application_cable/connection.rb +4 -0
- data/spec/rails_applications/6.1.4/app/controllers/application_controller.rb +2 -0
- data/spec/{dummy → rails_applications/6.1.4}/app/controllers/concerns/.keep +0 -0
- data/spec/{dummy → rails_applications/6.1.4}/app/controllers/home_controller.rb +4 -4
- data/spec/{dummy → rails_applications/6.1.4}/app/helpers/application_helper.rb +2 -2
- data/spec/rails_applications/6.1.4/app/javascript/channels/consumer.js +6 -0
- data/spec/rails_applications/6.1.4/app/javascript/channels/index.js +5 -0
- data/spec/rails_applications/6.1.4/app/javascript/packs/application.js +13 -0
- data/spec/rails_applications/6.1.4/app/jobs/application_job.rb +7 -0
- data/spec/rails_applications/6.1.4/app/mailers/application_mailer.rb +4 -0
- data/spec/rails_applications/6.1.4/app/models/application_record.rb +3 -0
- data/spec/{dummy/app/mailers → rails_applications/6.1.4/app/models/concerns}/.keep +0 -0
- data/spec/{dummy → rails_applications/6.1.4}/app/views/home/index.html.erb +3 -3
- data/spec/{dummy → rails_applications/6.1.4}/app/views/home/index.json.erb +1 -1
- data/spec/rails_applications/6.1.4/app/views/layouts/application.html.erb +13 -0
- data/spec/rails_applications/6.1.4/app/views/layouts/mailer.html.erb +13 -0
- data/spec/rails_applications/6.1.4/app/views/layouts/mailer.text.erb +1 -0
- data/spec/rails_applications/6.1.4/bin/rails +5 -0
- data/spec/rails_applications/6.1.4/bin/rake +5 -0
- data/spec/rails_applications/6.1.4/bin/setup +36 -0
- data/spec/rails_applications/6.1.4/bin/spring +14 -0
- data/spec/rails_applications/6.1.4/bin/yarn +17 -0
- data/spec/rails_applications/6.1.4/config/application.rb +22 -0
- data/spec/rails_applications/6.1.4/config/boot.rb +3 -0
- data/spec/rails_applications/6.1.4/config/cable.yml +10 -0
- data/spec/rails_applications/6.1.4/config/credentials.yml.enc +1 -0
- data/spec/{dummy → rails_applications/6.1.4}/config/database.yml +25 -25
- data/spec/{dummy → rails_applications/6.1.4}/config/environment.rb +5 -5
- data/spec/rails_applications/6.1.4/config/environments/development.rb +76 -0
- data/spec/rails_applications/6.1.4/config/environments/production.rb +120 -0
- data/spec/rails_applications/6.1.4/config/environments/test.rb +60 -0
- data/spec/rails_applications/6.1.4/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/rails_applications/6.1.4/config/initializers/assets.rb +14 -0
- data/spec/rails_applications/6.1.4/config/initializers/backtrace_silencers.rb +8 -0
- data/spec/rails_applications/6.1.4/config/initializers/content_security_policy.rb +30 -0
- data/spec/{dummy → rails_applications/6.1.4}/config/initializers/cookies_serializer.rb +5 -3
- data/spec/{dummy → rails_applications/6.1.4}/config/initializers/filter_parameter_logging.rb +6 -4
- data/spec/{dummy → rails_applications/6.1.4}/config/initializers/inflections.rb +16 -16
- data/spec/{dummy → rails_applications/6.1.4}/config/initializers/mime_types.rb +4 -4
- data/spec/rails_applications/6.1.4/config/initializers/permissions_policy.rb +11 -0
- data/spec/{dummy → rails_applications/6.1.4}/config/initializers/wrap_parameters.rb +14 -14
- data/spec/{dummy → rails_applications/6.1.4}/config/locales/en.yml +33 -23
- data/spec/rails_applications/6.1.4/config/master.key +1 -0
- data/spec/rails_applications/6.1.4/config/puma.rb +43 -0
- data/spec/rails_applications/6.1.4/config/routes.rb +4 -0
- data/spec/rails_applications/6.1.4/config/spring.rb +6 -0
- data/spec/rails_applications/6.1.4/config/storage.yml +34 -0
- data/spec/{dummy → rails_applications/6.1.4}/config.ru +6 -4
- data/spec/rails_applications/6.1.4/db/seeds.rb +7 -0
- data/spec/{dummy → rails_applications/6.1.4}/db/test.sqlite3 +0 -0
- data/spec/{dummy/app/models → rails_applications/6.1.4/lib/assets}/.keep +0 -0
- data/spec/{dummy/app/models/concerns → rails_applications/6.1.4/lib/tasks}/.keep +0 -0
- data/spec/rails_applications/6.1.4/package.json +11 -0
- data/spec/{dummy → rails_applications/6.1.4}/public/404.html +67 -67
- data/spec/{dummy → rails_applications/6.1.4}/public/422.html +67 -67
- data/spec/{dummy → rails_applications/6.1.4}/public/500.html +66 -66
- data/spec/{dummy/lib/assets/.keep → rails_applications/6.1.4/public/apple-touch-icon-precomposed.png} +0 -0
- data/spec/{dummy/lib/tasks/.keep → rails_applications/6.1.4/public/apple-touch-icon.png} +0 -0
- data/spec/{dummy → rails_applications/6.1.4}/public/favicon.ico +0 -0
- data/spec/rails_applications/6.1.4/public/robots.txt +1 -0
- data/spec/{dummy/log → rails_applications/6.1.4/storage}/.keep +0 -0
- data/spec/rails_applications/7.1.3/.dockerignore +37 -0
- data/spec/rails_applications/7.1.3/.gitattributes +9 -0
- data/spec/rails_applications/7.1.3/.gitignore +35 -0
- data/spec/rails_applications/7.1.3/.ruby-version +1 -0
- data/spec/rails_applications/7.1.3/Dockerfile +62 -0
- data/spec/rails_applications/7.1.3/Gemfile +67 -0
- data/spec/rails_applications/7.1.3/README.md +24 -0
- data/spec/rails_applications/7.1.3/Rakefile +6 -0
- data/spec/rails_applications/7.1.3/app/assets/config/manifest.js +4 -0
- data/spec/{dummy/test/controllers → rails_applications/7.1.3/app/assets/images}/.keep +0 -0
- data/spec/rails_applications/7.1.3/app/assets/stylesheets/application.css +15 -0
- data/spec/rails_applications/7.1.3/app/channels/application_cable/channel.rb +4 -0
- data/spec/rails_applications/7.1.3/app/channels/application_cable/connection.rb +4 -0
- data/spec/rails_applications/7.1.3/app/controllers/application_controller.rb +2 -0
- data/spec/{dummy/test/fixtures → rails_applications/7.1.3/app/controllers/concerns}/.keep +0 -0
- data/spec/rails_applications/7.1.3/app/controllers/home_controller.rb +2 -0
- data/spec/rails_applications/7.1.3/app/helpers/application_helper.rb +2 -0
- data/spec/rails_applications/7.1.3/app/helpers/home_helper.rb +2 -0
- data/spec/rails_applications/7.1.3/app/javascript/application.js +3 -0
- data/spec/rails_applications/7.1.3/app/javascript/controllers/application.js +9 -0
- data/spec/rails_applications/7.1.3/app/javascript/controllers/hello_controller.js +7 -0
- data/spec/rails_applications/7.1.3/app/javascript/controllers/index.js +11 -0
- data/spec/rails_applications/7.1.3/app/jobs/application_job.rb +7 -0
- data/spec/rails_applications/7.1.3/app/mailers/application_mailer.rb +4 -0
- data/spec/rails_applications/7.1.3/app/models/application_record.rb +3 -0
- data/spec/{dummy/test/helpers → rails_applications/7.1.3/app/models/concerns}/.keep +0 -0
- data/spec/rails_applications/7.1.3/app/views/home/index.html.erb +3 -0
- data/spec/rails_applications/7.1.3/app/views/home/index.json.erb +1 -0
- data/spec/rails_applications/7.1.3/app/views/layouts/application.html.erb +16 -0
- data/spec/rails_applications/7.1.3/app/views/layouts/mailer.html.erb +13 -0
- data/spec/rails_applications/7.1.3/app/views/layouts/mailer.text.erb +1 -0
- data/spec/rails_applications/7.1.3/bin/bundle +109 -0
- data/spec/rails_applications/7.1.3/bin/docker-entrypoint +8 -0
- data/spec/rails_applications/7.1.3/bin/importmap +4 -0
- data/spec/rails_applications/7.1.3/bin/rails +4 -0
- data/spec/rails_applications/7.1.3/bin/rake +4 -0
- data/spec/rails_applications/7.1.3/bin/setup +33 -0
- data/spec/rails_applications/7.1.3/config/application.rb +27 -0
- data/spec/rails_applications/7.1.3/config/boot.rb +4 -0
- data/spec/rails_applications/7.1.3/config/cable.yml +11 -0
- data/spec/rails_applications/7.1.3/config/credentials.yml.enc +1 -0
- data/spec/rails_applications/7.1.3/config/database.yml +25 -0
- data/spec/rails_applications/7.1.3/config/environment.rb +5 -0
- data/spec/rails_applications/7.1.3/config/environments/development.rb +76 -0
- data/spec/rails_applications/7.1.3/config/environments/production.rb +97 -0
- data/spec/rails_applications/7.1.3/config/environments/test.rb +64 -0
- data/spec/rails_applications/7.1.3/config/importmap.rb +7 -0
- data/spec/rails_applications/7.1.3/config/initializers/assets.rb +12 -0
- data/spec/rails_applications/7.1.3/config/initializers/content_security_policy.rb +25 -0
- data/spec/rails_applications/7.1.3/config/initializers/filter_parameter_logging.rb +8 -0
- data/spec/rails_applications/7.1.3/config/initializers/inflections.rb +16 -0
- data/spec/rails_applications/7.1.3/config/initializers/permissions_policy.rb +13 -0
- data/spec/rails_applications/7.1.3/config/locales/en.yml +31 -0
- data/spec/rails_applications/7.1.3/config/puma.rb +35 -0
- data/spec/rails_applications/7.1.3/config/routes.rb +11 -0
- data/spec/rails_applications/7.1.3/config/storage.yml +34 -0
- data/spec/rails_applications/7.1.3/config.ru +6 -0
- data/spec/rails_applications/7.1.3/db/seeds.rb +9 -0
- data/spec/{dummy/test/integration → rails_applications/7.1.3/lib/assets}/.keep +0 -0
- data/spec/{dummy/test/mailers → rails_applications/7.1.3/lib/tasks}/.keep +0 -0
- data/spec/rails_applications/7.1.3/public/404.html +67 -0
- data/spec/rails_applications/7.1.3/public/422.html +67 -0
- data/spec/rails_applications/7.1.3/public/500.html +66 -0
- data/spec/{dummy/test/models/.keep → rails_applications/7.1.3/public/apple-touch-icon-precomposed.png} +0 -0
- data/spec/{dummy/vendor/assets/javascripts/.keep → rails_applications/7.1.3/public/apple-touch-icon.png} +0 -0
- data/spec/{dummy/vendor/assets/stylesheets/.keep → rails_applications/7.1.3/public/favicon.ico} +0 -0
- data/spec/rails_applications/7.1.3/public/robots.txt +1 -0
- data/spec/rails_applications/7.1.3/storage/.keep +0 -0
- data/spec/rails_applications/7.1.3/test/application_system_test_case.rb +5 -0
- data/spec/rails_applications/7.1.3/test/channels/application_cable/connection_test.rb +13 -0
- data/spec/rails_applications/7.1.3/test/controllers/.keep +0 -0
- data/spec/rails_applications/7.1.3/test/controllers/home_controller_test.rb +7 -0
- data/spec/rails_applications/7.1.3/test/fixtures/files/.keep +0 -0
- data/spec/rails_applications/7.1.3/test/helpers/.keep +0 -0
- data/spec/rails_applications/7.1.3/test/integration/.keep +0 -0
- data/spec/rails_applications/7.1.3/test/mailers/.keep +0 -0
- data/spec/rails_applications/7.1.3/test/models/.keep +0 -0
- data/spec/rails_applications/7.1.3/test/system/.keep +0 -0
- data/spec/rails_applications/7.1.3/test/test_helper.rb +15 -0
- data/spec/rails_applications/7.1.3/vendor/.keep +0 -0
- data/spec/rails_applications/7.1.3/vendor/javascript/.keep +0 -0
- data/spec/rails_helper.rb +8 -4
- data/spec/raygun/breadcrumbs/breadcrumb_spec.rb +171 -171
- data/spec/raygun/breadcrumbs/store_spec.rb +170 -170
- data/spec/services/apply_whitelist_filter_to_payload_spec.rb +251 -251
- data/spec/spec_helper.rb +24 -24
- data/spec/support/fake_logger.rb +17 -17
- data/test/integration/client_test.rb +19 -19
- data/test/rails_helper.rb +6 -0
- data/test/test_helper.rb +76 -72
- data/test/unit/affected_user_test.rb +136 -136
- data/test/unit/client_test.rb +812 -812
- data/test/unit/configuration_test.rb +202 -206
- data/test/unit/error_subscriber_test.rb +43 -0
- data/test/unit/raygun_test.rb +106 -25
- data/test/unit/resque_failure_test.rb +27 -24
- data/test/unit/sidekiq_failure_test.rb +42 -32
- metadata +186 -125
- data/.travis.yml +0 -20
- data/spec/dummy/.gitignore +0 -17
- data/spec/dummy/Gemfile +0 -47
- data/spec/dummy/app/assets/config/manifest.js +0 -3
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/controllers/application_controller.rb +0 -5
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -9
- data/spec/dummy/bin/rake +0 -9
- data/spec/dummy/bin/setup +0 -29
- data/spec/dummy/bin/spring +0 -17
- data/spec/dummy/config/application.rb +0 -26
- data/spec/dummy/config/boot.rb +0 -3
- data/spec/dummy/config/environments/development.rb +0 -41
- data/spec/dummy/config/environments/production.rb +0 -79
- data/spec/dummy/config/environments/test.rb +0 -42
- data/spec/dummy/config/initializers/assets.rb +0 -11
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/to_time_preserves_timezone.rb +0 -10
- data/spec/dummy/config/routes.rb +0 -58
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/db/seeds.rb +0 -7
- data/spec/dummy/public/robots.txt +0 -5
- data/spec/dummy/test/test_helper.rb +0 -10
- data/spec/raygun/raygun_spec.rb +0 -47
data/lib/raygun.rb
CHANGED
@@ -1,179 +1,197 @@
|
|
1
|
-
require "concurrent"
|
2
|
-
require "httparty"
|
3
|
-
require "logger"
|
4
|
-
require "json"
|
5
|
-
require "socket"
|
6
|
-
require "rack"
|
7
|
-
require "ostruct"
|
8
|
-
|
9
|
-
require "raygun/version"
|
10
|
-
require "raygun/configuration"
|
11
|
-
require "raygun/client"
|
12
|
-
require "raygun/javascript_tracker"
|
13
|
-
require "raygun/middleware/rack_exception_interceptor"
|
14
|
-
require "raygun/middleware/breadcrumbs_store_initializer"
|
15
|
-
require "raygun/middleware/javascript_exception_tracking"
|
16
|
-
require "raygun/demo_exception"
|
17
|
-
require "raygun/
|
18
|
-
require "raygun/
|
19
|
-
require "raygun/
|
20
|
-
require "raygun/
|
21
|
-
require "raygun/breadcrumbs/
|
22
|
-
require "raygun/breadcrumbs"
|
23
|
-
require "raygun/
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
def
|
48
|
-
configuration.
|
49
|
-
end
|
50
|
-
|
51
|
-
def
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
def
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
def
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
if
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
end
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
end
|
1
|
+
require "concurrent"
|
2
|
+
require "httparty"
|
3
|
+
require "logger"
|
4
|
+
require "json"
|
5
|
+
require "socket"
|
6
|
+
require "rack"
|
7
|
+
require "ostruct"
|
8
|
+
|
9
|
+
require "raygun/version"
|
10
|
+
require "raygun/configuration"
|
11
|
+
require "raygun/client"
|
12
|
+
require "raygun/javascript_tracker"
|
13
|
+
require "raygun/middleware/rack_exception_interceptor"
|
14
|
+
require "raygun/middleware/breadcrumbs_store_initializer"
|
15
|
+
require "raygun/middleware/javascript_exception_tracking"
|
16
|
+
require "raygun/demo_exception"
|
17
|
+
require "raygun/error_subscriber"
|
18
|
+
require "raygun/error"
|
19
|
+
require "raygun/affected_user"
|
20
|
+
require "raygun/services/apply_whitelist_filter_to_payload"
|
21
|
+
require "raygun/breadcrumbs/breadcrumb"
|
22
|
+
require "raygun/breadcrumbs/store"
|
23
|
+
require "raygun/breadcrumbs"
|
24
|
+
require "raygun/railtie" if defined?(Rails)
|
25
|
+
|
26
|
+
module Raygun
|
27
|
+
|
28
|
+
# used to identify ourselves to Raygun
|
29
|
+
CLIENT_URL = "https://github.com/MindscapeHQ/raygun4ruby"
|
30
|
+
CLIENT_NAME = "Raygun4Ruby Gem"
|
31
|
+
|
32
|
+
class << self
|
33
|
+
include DemoException
|
34
|
+
|
35
|
+
# Configuration Object (instance of Raygun::Configuration)
|
36
|
+
attr_writer :configuration
|
37
|
+
|
38
|
+
# List of futures that are currently running
|
39
|
+
@@active_futures = []
|
40
|
+
|
41
|
+
def setup
|
42
|
+
yield(configuration)
|
43
|
+
|
44
|
+
log("configuration settings: #{configuration.inspect}")
|
45
|
+
end
|
46
|
+
|
47
|
+
def configuration
|
48
|
+
@configuration ||= Configuration.new
|
49
|
+
end
|
50
|
+
|
51
|
+
def default_configuration
|
52
|
+
configuration.defaults
|
53
|
+
end
|
54
|
+
|
55
|
+
def reset_configuration
|
56
|
+
@configuration = Configuration.new
|
57
|
+
end
|
58
|
+
|
59
|
+
def configured?
|
60
|
+
!!configuration.api_key
|
61
|
+
end
|
62
|
+
|
63
|
+
def track_exception(exception_instance, env = {}, user = nil, retry_count = 1)
|
64
|
+
log('tracking exception')
|
65
|
+
|
66
|
+
exception_instance.set_backtrace(caller) if exception_instance.is_a?(Exception) && exception_instance.backtrace.nil?
|
67
|
+
|
68
|
+
result = if configuration.send_in_background
|
69
|
+
track_exception_async(exception_instance, env, user, retry_count)
|
70
|
+
else
|
71
|
+
track_exception_sync(exception_instance, env, user, retry_count)
|
72
|
+
end
|
73
|
+
|
74
|
+
result
|
75
|
+
end
|
76
|
+
|
77
|
+
def track_exceptions
|
78
|
+
yield
|
79
|
+
rescue => e
|
80
|
+
track_exception(e)
|
81
|
+
end
|
82
|
+
|
83
|
+
def record_breadcrumb(
|
84
|
+
message: nil,
|
85
|
+
category: '',
|
86
|
+
level: :info,
|
87
|
+
timestamp: Time.now.utc,
|
88
|
+
metadata: {},
|
89
|
+
class_name: nil,
|
90
|
+
method_name: nil,
|
91
|
+
line_number: nil
|
92
|
+
)
|
93
|
+
log('recording breadcrumb')
|
94
|
+
|
95
|
+
Raygun::Breadcrumbs::Store.record(
|
96
|
+
message: message,
|
97
|
+
category: category,
|
98
|
+
level: level,
|
99
|
+
timestamp: timestamp,
|
100
|
+
metadata: metadata,
|
101
|
+
class_name: class_name,
|
102
|
+
method_name: method_name,
|
103
|
+
line_number: line_number,
|
104
|
+
)
|
105
|
+
end
|
106
|
+
|
107
|
+
def log(message)
|
108
|
+
return unless configuration.debug
|
109
|
+
|
110
|
+
configuration.logger.info("[Raygun] #{message}") if configuration.logger
|
111
|
+
end
|
112
|
+
|
113
|
+
def failsafe_log(message)
|
114
|
+
configuration.failsafe_logger.info(message)
|
115
|
+
end
|
116
|
+
|
117
|
+
def deprecation_warning(message)
|
118
|
+
if defined?(ActiveSupport::Deprecation)
|
119
|
+
ActiveSupport::Deprecation.warn(message)
|
120
|
+
else
|
121
|
+
puts message
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def wait_for_futures
|
126
|
+
@@active_futures.each(&:value)
|
127
|
+
end
|
128
|
+
|
129
|
+
private
|
130
|
+
|
131
|
+
def track_exception_async(exception_instance, env, user, retry_count)
|
132
|
+
env[:rg_breadcrumb_store] = Raygun::Breadcrumbs::Store.take_until_size(Client::MAX_BREADCRUMBS_SIZE) if Raygun::Breadcrumbs::Store.any?
|
133
|
+
|
134
|
+
future = Concurrent::Future.execute { track_exception_sync(exception_instance, env, user, retry_count) }
|
135
|
+
future.add_observer(lambda do |_, value, reason|
|
136
|
+
if value == nil || !value.responds_to?(:response) || value.response.code != "202"
|
137
|
+
log("unexpected response from Raygun, could indicate error: #{value.inspect}")
|
138
|
+
end
|
139
|
+
@@active_futures.delete(future)
|
140
|
+
end, :call)
|
141
|
+
@@active_futures << future
|
142
|
+
|
143
|
+
future
|
144
|
+
end
|
145
|
+
|
146
|
+
def track_exception_sync(exception_instance, env, user, retry_count)
|
147
|
+
if should_report?(exception_instance)
|
148
|
+
log('attempting to send exception')
|
149
|
+
resp = Client.new.track_exception(exception_instance, env, user)
|
150
|
+
log('sent payload to api')
|
151
|
+
|
152
|
+
resp
|
153
|
+
end
|
154
|
+
rescue Exception => e
|
155
|
+
log('error sending exception to raygun, see failsafe logger for more information')
|
156
|
+
|
157
|
+
if configuration.failsafe_logger
|
158
|
+
failsafe_log("Problem reporting exception to Raygun: #{e.class}: #{e.message}\n\n#{e.backtrace.join("\n")}")
|
159
|
+
end
|
160
|
+
|
161
|
+
if retry_count > 0
|
162
|
+
new_exception = e.exception("raygun4ruby encountered an exception processing your exception")
|
163
|
+
new_exception.set_backtrace(e.backtrace)
|
164
|
+
|
165
|
+
env[:custom_data] ||= {}
|
166
|
+
env[:custom_data].merge!(original_stacktrace: exception_instance.backtrace)
|
167
|
+
|
168
|
+
::Raygun::Breadcrumbs::Store.clear
|
169
|
+
|
170
|
+
track_exception(new_exception, env, user, retry_count - 1)
|
171
|
+
else
|
172
|
+
raise e
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
|
177
|
+
def print_api_key_warning
|
178
|
+
$stderr.puts(NO_API_KEY_MESSAGE)
|
179
|
+
end
|
180
|
+
|
181
|
+
def should_report?(exception)
|
182
|
+
if configuration.silence_reporting
|
183
|
+
log('skipping reporting because Configuration.silence_reporting is enabled')
|
184
|
+
|
185
|
+
return false
|
186
|
+
end
|
187
|
+
|
188
|
+
if configuration.ignore.flatten.include?(exception.class.to_s)
|
189
|
+
log("skipping reporting of exception #{exception.class} because it is in the ignore list")
|
190
|
+
|
191
|
+
return false
|
192
|
+
end
|
193
|
+
|
194
|
+
true
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
data/lib/raygun4ruby.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require "raygun"
|
1
|
+
require "raygun"
|
@@ -1,26 +1,26 @@
|
|
1
|
-
begin
|
2
|
-
require 'resque'
|
3
|
-
rescue LoadError
|
4
|
-
raise "Can't find 'resque' gem. You'll need to require it before you require the Raygun Failure handler"
|
5
|
-
end
|
6
|
-
|
7
|
-
module Resque
|
8
|
-
module Failure
|
9
|
-
class Raygun < Base
|
10
|
-
|
11
|
-
def save
|
12
|
-
::Raygun.track_exception(exception,
|
13
|
-
custom_data: {
|
14
|
-
resque: {
|
15
|
-
worker: worker.to_s,
|
16
|
-
queue: queue.to_s,
|
17
|
-
job: payload['class'].to_s,
|
18
|
-
args: payload['args'].inspect
|
19
|
-
}
|
20
|
-
}
|
21
|
-
)
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
1
|
+
begin
|
2
|
+
require 'resque'
|
3
|
+
rescue LoadError
|
4
|
+
raise "Can't find 'resque' gem. You'll need to require it before you require the Raygun Failure handler"
|
5
|
+
end
|
6
|
+
|
7
|
+
module Resque
|
8
|
+
module Failure
|
9
|
+
class Raygun < Base
|
10
|
+
|
11
|
+
def save
|
12
|
+
::Raygun.track_exception(exception,
|
13
|
+
custom_data: {
|
14
|
+
resque: {
|
15
|
+
worker: worker.to_s,
|
16
|
+
queue: queue.to_s,
|
17
|
+
job: payload['class'].to_s,
|
18
|
+
args: payload['args'].inspect
|
19
|
+
}
|
20
|
+
}
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
26
|
end
|
data/lib/tasks/raygun.tasks
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
namespace :raygun do
|
2
|
-
|
3
|
-
desc "Test Raygun integration"
|
4
|
-
task :test => :environment do
|
5
|
-
Raygun.track_test_exception
|
6
|
-
end
|
7
|
-
|
1
|
+
namespace :raygun do
|
2
|
+
|
3
|
+
desc "Test Raygun integration"
|
4
|
+
task :test => :environment do
|
5
|
+
Raygun.track_test_exception
|
6
|
+
end
|
7
|
+
|
8
8
|
end
|
data/raygun4ruby.gemspec
CHANGED
@@ -1,45 +1,43 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "raygun4ruby"
|
8
|
-
spec.version = Raygun::VERSION
|
9
|
-
spec.authors = ["Mindscape", "Nik Wakelin"]
|
10
|
-
spec.email = ["hello@raygun.com"]
|
11
|
-
spec.description = %q{Ruby Adapter for Raygun}
|
12
|
-
spec.summary = %q{This gem provides support for Ruby and Ruby on Rails for the Raygun error reporter}
|
13
|
-
spec.homepage = "https://raygun.com"
|
14
|
-
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version =
|
16
|
-
|
17
|
-
spec.files = `git ls-files | grep -Ev
|
18
|
-
spec.test_files = `git ls-files -- test/*`.split("\n")
|
19
|
-
|
20
|
-
spec.executables = []
|
21
|
-
spec.require_paths = ["lib"]
|
22
|
-
|
23
|
-
spec.add_runtime_dependency "httparty", "> 0.13.7"
|
24
|
-
spec.add_runtime_dependency "json"
|
25
|
-
spec.add_runtime_dependency "rack"
|
26
|
-
spec.add_runtime_dependency "concurrent-ruby"
|
27
|
-
|
28
|
-
spec.add_development_dependency "bundler", ">=
|
29
|
-
spec.add_development_dependency "rake", ">= 12.3.3"
|
30
|
-
spec.add_development_dependency "
|
31
|
-
spec.add_development_dependency "
|
32
|
-
spec.add_development_dependency "
|
33
|
-
spec.add_development_dependency "
|
34
|
-
spec.add_development_dependency "
|
35
|
-
spec.add_development_dependency "mocha"
|
36
|
-
spec.add_development_dependency "pry"
|
37
|
-
spec.add_development_dependency "webmock"
|
38
|
-
|
39
|
-
spec.add_development_dependency
|
40
|
-
spec.add_development_dependency
|
41
|
-
spec.add_development_dependency
|
42
|
-
spec.add_development_dependency "
|
43
|
-
|
44
|
-
spec.add_development_dependency "simplecov"
|
45
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "raygun/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "raygun4ruby"
|
8
|
+
spec.version = Raygun::VERSION
|
9
|
+
spec.authors = ["Mindscape", "Nik Wakelin"]
|
10
|
+
spec.email = ["hello@raygun.com"]
|
11
|
+
spec.description = %q{Ruby Adapter for Raygun}
|
12
|
+
spec.summary = %q{This gem provides support for Ruby and Ruby on Rails for the Raygun.com error reporter}
|
13
|
+
spec.homepage = "https://raygun.com"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 2.0"
|
16
|
+
|
17
|
+
spec.files = `git ls-files | grep -Ev "^(test)"`.split("\n")
|
18
|
+
spec.test_files = `git ls-files -- test/*`.split("\n")
|
19
|
+
|
20
|
+
spec.executables = []
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_runtime_dependency "httparty", "> 0.13.7"
|
24
|
+
spec.add_runtime_dependency "json"
|
25
|
+
spec.add_runtime_dependency "rack"
|
26
|
+
spec.add_runtime_dependency "concurrent-ruby"
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler", ">= 2.3"
|
29
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
30
|
+
spec.add_development_dependency "appraisal"
|
31
|
+
spec.add_development_dependency "timecop"
|
32
|
+
spec.add_development_dependency "minitest", "~> 5.11"
|
33
|
+
spec.add_development_dependency "redis-namespace", ">= 1.3.1"
|
34
|
+
spec.add_development_dependency "resque"
|
35
|
+
spec.add_development_dependency "mocha"
|
36
|
+
spec.add_development_dependency "pry"
|
37
|
+
spec.add_development_dependency "webmock"
|
38
|
+
|
39
|
+
spec.add_development_dependency "capybara"
|
40
|
+
spec.add_development_dependency "rspec-rails"
|
41
|
+
spec.add_development_dependency "launchy"
|
42
|
+
spec.add_development_dependency "simplecov"
|
43
|
+
end
|
@@ -1,48 +1,48 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
|
3
|
-
feature 'JavaScript Tracking', feature: true do
|
4
|
-
before { Raygun.configuration.js_api_key = nil }
|
5
|
-
after { Raygun.configuration.js_api_key = nil }
|
6
|
-
|
7
|
-
it "Includes the Raygun Javascript Middleware" do
|
8
|
-
expect(Rails.application.config.middleware).to include(Raygun::Middleware::JavascriptExceptionTracking)
|
9
|
-
end
|
10
|
-
|
11
|
-
it "Does not inject the JS snippet" do
|
12
|
-
visit root_path
|
13
|
-
|
14
|
-
expect(page.html).to_not include('cdn.raygun.io/raygun4js/raygun.min.js')
|
15
|
-
expect(page.html).to_not include('rg4js(')
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'With a JS API Key' do
|
19
|
-
before { Raygun.configuration.js_api_key = 'Sample key' }
|
20
|
-
|
21
|
-
it "Injects the JS snippet" do
|
22
|
-
visit root_path
|
23
|
-
|
24
|
-
expect(page.html).to include('cdn.raygun.io/raygun4js/raygun.min.js')
|
25
|
-
expect(page.html).to include('rg4js(')
|
26
|
-
end
|
27
|
-
|
28
|
-
it "Does not inject the JS snippet" do
|
29
|
-
visit root_path(format: :json)
|
30
|
-
|
31
|
-
expect(page.html).to_not include('cdn.raygun.io/raygun4js/raygun.min.js')
|
32
|
-
expect(page.html).to_not include('rg4js(')
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context "With JS version overriden" do
|
37
|
-
before do
|
38
|
-
Raygun.configuration.js_api_version = "2.14.1"
|
39
|
-
Raygun.configuration.js_api_key = "Sample key"
|
40
|
-
end
|
41
|
-
|
42
|
-
it "Uses the overriden version" do
|
43
|
-
visit root_path
|
44
|
-
|
45
|
-
expect(page.html).to include('cdn.raygun.io/raygun4js/2.14.1/raygun.min.js')
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
feature 'JavaScript Tracking', feature: true do
|
4
|
+
before { Raygun.configuration.js_api_key = nil }
|
5
|
+
after { Raygun.configuration.js_api_key = nil }
|
6
|
+
|
7
|
+
it "Includes the Raygun Javascript Middleware" do
|
8
|
+
expect(Rails.application.config.middleware).to include(Raygun::Middleware::JavascriptExceptionTracking)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "Does not inject the JS snippet" do
|
12
|
+
visit root_path
|
13
|
+
|
14
|
+
expect(page.html).to_not include('cdn.raygun.io/raygun4js/raygun.min.js')
|
15
|
+
expect(page.html).to_not include('rg4js(')
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'With a JS API Key' do
|
19
|
+
before { Raygun.configuration.js_api_key = 'Sample key' }
|
20
|
+
|
21
|
+
it "Injects the JS snippet" do
|
22
|
+
visit root_path
|
23
|
+
|
24
|
+
expect(page.html).to include('cdn.raygun.io/raygun4js/raygun.min.js')
|
25
|
+
expect(page.html).to include('rg4js(')
|
26
|
+
end
|
27
|
+
|
28
|
+
it "Does not inject the JS snippet" do
|
29
|
+
visit root_path(format: :json)
|
30
|
+
|
31
|
+
expect(page.html).to_not include('cdn.raygun.io/raygun4js/raygun.min.js')
|
32
|
+
expect(page.html).to_not include('rg4js(')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context "With JS version overriden" do
|
37
|
+
before do
|
38
|
+
Raygun.configuration.js_api_version = "2.14.1"
|
39
|
+
Raygun.configuration.js_api_key = "Sample key"
|
40
|
+
end
|
41
|
+
|
42
|
+
it "Uses the overriden version" do
|
43
|
+
visit root_path
|
44
|
+
|
45
|
+
expect(page.html).to include('cdn.raygun.io/raygun4js/2.14.1/raygun.min.js')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|