sentry-raven 2.7.4 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (212) hide show
  1. checksums.yaml +5 -5
  2. data/.craft.yml +15 -0
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
  4. data/.github/pull_request_template.md +16 -0
  5. data/.github/workflows/test.yml +92 -0
  6. data/.github/workflows/zeus_upload.yml +32 -0
  7. data/.gitignore +3 -1
  8. data/.gitmodules +0 -3
  9. data/.rubocop.yml +50 -12
  10. data/.scripts/bump-version.sh +9 -0
  11. data/{changelog.md → CHANGELOG.md} +238 -1
  12. data/CONTRIBUTING.md +71 -0
  13. data/Gemfile +21 -26
  14. data/README.md +42 -22
  15. data/lib/raven/backtrace.rb +9 -5
  16. data/lib/raven/base.rb +8 -3
  17. data/lib/raven/breadcrumbs.rb +1 -1
  18. data/lib/raven/breadcrumbs/{activesupport.rb → active_support_logger.rb} +9 -3
  19. data/lib/raven/breadcrumbs/logger.rb +2 -92
  20. data/lib/raven/breadcrumbs/sentry_logger.rb +73 -0
  21. data/lib/raven/cli.rb +10 -21
  22. data/lib/raven/client.rb +37 -11
  23. data/lib/raven/configuration.rb +141 -20
  24. data/lib/raven/context.rb +13 -8
  25. data/lib/raven/core_ext/object/deep_dup.rb +57 -0
  26. data/lib/raven/core_ext/object/duplicable.rb +153 -0
  27. data/lib/raven/event.rb +29 -37
  28. data/lib/raven/helpers/deprecation_helper.rb +17 -0
  29. data/lib/raven/instance.rb +30 -8
  30. data/lib/raven/integrations/delayed_job.rb +16 -16
  31. data/lib/raven/integrations/rack-timeout.rb +7 -4
  32. data/lib/raven/integrations/rack.rb +19 -5
  33. data/lib/raven/integrations/rails.rb +13 -3
  34. data/lib/raven/integrations/rails/active_job.rb +11 -7
  35. data/lib/raven/integrations/rails/backtrace_cleaner.rb +29 -0
  36. data/lib/raven/integrations/rails/controller_transaction.rb +1 -1
  37. data/lib/raven/integrations/rails/overrides/debug_exceptions_catcher.rb +2 -2
  38. data/lib/raven/integrations/sidekiq.rb +4 -78
  39. data/lib/raven/integrations/sidekiq/cleanup_middleware.rb +13 -0
  40. data/lib/raven/integrations/sidekiq/error_handler.rb +38 -0
  41. data/lib/raven/interface.rb +2 -2
  42. data/lib/raven/interfaces/stack_trace.rb +1 -1
  43. data/lib/raven/linecache.rb +5 -2
  44. data/lib/raven/logger.rb +3 -2
  45. data/lib/raven/processor/cookies.rb +16 -6
  46. data/lib/raven/processor/post_data.rb +2 -0
  47. data/lib/raven/processor/removecircularreferences.rb +3 -1
  48. data/lib/raven/processor/sanitizedata.rb +65 -17
  49. data/lib/raven/processor/utf8conversion.rb +3 -1
  50. data/lib/raven/transports.rb +4 -0
  51. data/lib/raven/transports/http.rb +5 -7
  52. data/lib/raven/transports/stdout.rb +20 -0
  53. data/lib/raven/utils/context_filter.rb +42 -0
  54. data/lib/raven/utils/exception_cause_chain.rb +20 -0
  55. data/lib/raven/utils/real_ip.rb +1 -1
  56. data/lib/raven/version.rb +2 -2
  57. data/lib/sentry-raven-without-integrations.rb +6 -1
  58. data/lib/sentry_raven_without_integrations.rb +1 -0
  59. data/sentry-raven.gemspec +3 -4
  60. data/sentry-ruby/.gitignore +11 -0
  61. data/sentry-ruby/.rspec +3 -0
  62. data/sentry-ruby/.travis.yml +6 -0
  63. data/sentry-ruby/CODE_OF_CONDUCT.md +74 -0
  64. data/sentry-ruby/Gemfile +9 -0
  65. data/sentry-ruby/LICENSE.txt +21 -0
  66. data/sentry-ruby/README.md +44 -0
  67. data/sentry-ruby/Rakefile +6 -0
  68. data/sentry-ruby/bin/console +14 -0
  69. data/sentry-ruby/bin/setup +8 -0
  70. data/sentry-ruby/examples/rails-6.0/.browserslistrc +1 -0
  71. data/sentry-ruby/examples/rails-6.0/.gitignore +35 -0
  72. data/sentry-ruby/examples/rails-6.0/Gemfile +58 -0
  73. data/sentry-ruby/examples/rails-6.0/README.md +23 -0
  74. data/sentry-ruby/examples/rails-6.0/Rakefile +6 -0
  75. data/sentry-ruby/examples/rails-6.0/app/assets/config/manifest.js +2 -0
  76. data/sentry-ruby/examples/rails-6.0/app/assets/images/.keep +0 -0
  77. data/sentry-ruby/examples/rails-6.0/app/assets/stylesheets/application.css +15 -0
  78. data/sentry-ruby/examples/rails-6.0/app/channels/application_cable/channel.rb +4 -0
  79. data/sentry-ruby/examples/rails-6.0/app/channels/application_cable/connection.rb +4 -0
  80. data/sentry-ruby/examples/rails-6.0/app/controllers/application_controller.rb +2 -0
  81. data/sentry-ruby/examples/rails-6.0/app/controllers/concerns/.keep +0 -0
  82. data/sentry-ruby/examples/rails-6.0/app/controllers/welcome_controller.rb +23 -0
  83. data/sentry-ruby/examples/rails-6.0/app/helpers/application_helper.rb +2 -0
  84. data/sentry-ruby/examples/rails-6.0/app/javascript/channels/consumer.js +6 -0
  85. data/sentry-ruby/examples/rails-6.0/app/javascript/channels/index.js +5 -0
  86. data/sentry-ruby/examples/rails-6.0/app/javascript/packs/application.js +17 -0
  87. data/sentry-ruby/examples/rails-6.0/app/jobs/application_job.rb +7 -0
  88. data/sentry-ruby/examples/rails-6.0/app/mailers/application_mailer.rb +4 -0
  89. data/sentry-ruby/examples/rails-6.0/app/models/application_record.rb +3 -0
  90. data/sentry-ruby/examples/rails-6.0/app/models/concerns/.keep +0 -0
  91. data/sentry-ruby/examples/rails-6.0/app/views/layouts/application.html.erb +15 -0
  92. data/sentry-ruby/examples/rails-6.0/app/views/layouts/mailer.html.erb +13 -0
  93. data/sentry-ruby/examples/rails-6.0/app/views/layouts/mailer.text.erb +1 -0
  94. data/sentry-ruby/examples/rails-6.0/app/views/welcome/report_demo.html.erb +22 -0
  95. data/sentry-ruby/examples/rails-6.0/app/views/welcome/view_error.html.erb +1 -0
  96. data/sentry-ruby/examples/rails-6.0/app/workers/error_worker.rb +7 -0
  97. data/sentry-ruby/examples/rails-6.0/babel.config.js +72 -0
  98. data/sentry-ruby/examples/rails-6.0/bin/bundle +114 -0
  99. data/sentry-ruby/examples/rails-6.0/bin/rails +9 -0
  100. data/sentry-ruby/examples/rails-6.0/bin/rake +9 -0
  101. data/sentry-ruby/examples/rails-6.0/bin/setup +36 -0
  102. data/sentry-ruby/examples/rails-6.0/bin/spring +17 -0
  103. data/sentry-ruby/examples/rails-6.0/bin/webpack +18 -0
  104. data/sentry-ruby/examples/rails-6.0/bin/webpack-dev-server +18 -0
  105. data/sentry-ruby/examples/rails-6.0/bin/yarn +11 -0
  106. data/sentry-ruby/examples/rails-6.0/config.ru +5 -0
  107. data/sentry-ruby/examples/rails-6.0/config/application.rb +28 -0
  108. data/sentry-ruby/examples/rails-6.0/config/boot.rb +4 -0
  109. data/sentry-ruby/examples/rails-6.0/config/cable.yml +10 -0
  110. data/sentry-ruby/examples/rails-6.0/config/credentials.yml.enc +1 -0
  111. data/sentry-ruby/examples/rails-6.0/config/database.yml +25 -0
  112. data/sentry-ruby/examples/rails-6.0/config/environment.rb +5 -0
  113. data/sentry-ruby/examples/rails-6.0/config/environments/development.rb +62 -0
  114. data/sentry-ruby/examples/rails-6.0/config/environments/production.rb +112 -0
  115. data/sentry-ruby/examples/rails-6.0/config/environments/test.rb +48 -0
  116. data/sentry-ruby/examples/rails-6.0/config/initializers/application_controller_renderer.rb +8 -0
  117. data/sentry-ruby/examples/rails-6.0/config/initializers/assets.rb +14 -0
  118. data/sentry-ruby/examples/rails-6.0/config/initializers/backtrace_silencers.rb +7 -0
  119. data/sentry-ruby/examples/rails-6.0/config/initializers/content_security_policy.rb +30 -0
  120. data/sentry-ruby/examples/rails-6.0/config/initializers/cookies_serializer.rb +5 -0
  121. data/sentry-ruby/examples/rails-6.0/config/initializers/filter_parameter_logging.rb +4 -0
  122. data/sentry-ruby/examples/rails-6.0/config/initializers/inflections.rb +16 -0
  123. data/sentry-ruby/examples/rails-6.0/config/initializers/mime_types.rb +4 -0
  124. data/sentry-ruby/examples/rails-6.0/config/initializers/wrap_parameters.rb +14 -0
  125. data/sentry-ruby/examples/rails-6.0/config/locales/en.yml +33 -0
  126. data/sentry-ruby/examples/rails-6.0/config/puma.rb +38 -0
  127. data/sentry-ruby/examples/rails-6.0/config/routes.rb +10 -0
  128. data/sentry-ruby/examples/rails-6.0/config/spring.rb +6 -0
  129. data/sentry-ruby/examples/rails-6.0/config/storage.yml +34 -0
  130. data/sentry-ruby/examples/rails-6.0/config/webpack/development.js +5 -0
  131. data/sentry-ruby/examples/rails-6.0/config/webpack/environment.js +3 -0
  132. data/sentry-ruby/examples/rails-6.0/config/webpack/production.js +5 -0
  133. data/sentry-ruby/examples/rails-6.0/config/webpack/test.js +5 -0
  134. data/sentry-ruby/examples/rails-6.0/config/webpacker.yml +96 -0
  135. data/sentry-ruby/examples/rails-6.0/db/seeds.rb +7 -0
  136. data/sentry-ruby/examples/rails-6.0/lib/assets/.keep +0 -0
  137. data/sentry-ruby/examples/rails-6.0/lib/tasks/.keep +0 -0
  138. data/sentry-ruby/examples/rails-6.0/package.json +15 -0
  139. data/sentry-ruby/examples/rails-6.0/postcss.config.js +12 -0
  140. data/sentry-ruby/examples/rails-6.0/public/404.html +67 -0
  141. data/sentry-ruby/examples/rails-6.0/public/422.html +67 -0
  142. data/sentry-ruby/examples/rails-6.0/public/500.html +66 -0
  143. data/sentry-ruby/examples/rails-6.0/public/apple-touch-icon-precomposed.png +0 -0
  144. data/sentry-ruby/examples/rails-6.0/public/apple-touch-icon.png +0 -0
  145. data/sentry-ruby/examples/rails-6.0/public/favicon.ico +0 -0
  146. data/sentry-ruby/examples/rails-6.0/public/robots.txt +1 -0
  147. data/sentry-ruby/examples/rails-6.0/storage/.keep +0 -0
  148. data/sentry-ruby/examples/rails-6.0/test/application_system_test_case.rb +5 -0
  149. data/sentry-ruby/examples/rails-6.0/test/channels/application_cable/connection_test.rb +11 -0
  150. data/sentry-ruby/examples/rails-6.0/test/controllers/.keep +0 -0
  151. data/sentry-ruby/examples/rails-6.0/test/fixtures/.keep +0 -0
  152. data/sentry-ruby/examples/rails-6.0/test/fixtures/files/.keep +0 -0
  153. data/sentry-ruby/examples/rails-6.0/test/helpers/.keep +0 -0
  154. data/sentry-ruby/examples/rails-6.0/test/integration/.keep +0 -0
  155. data/sentry-ruby/examples/rails-6.0/test/mailers/.keep +0 -0
  156. data/sentry-ruby/examples/rails-6.0/test/models/.keep +0 -0
  157. data/sentry-ruby/examples/rails-6.0/test/system/.keep +0 -0
  158. data/sentry-ruby/examples/rails-6.0/test/test_helper.rb +13 -0
  159. data/sentry-ruby/examples/rails-6.0/vendor/.keep +0 -0
  160. data/sentry-ruby/examples/rails-6.0/yarn.lock +7508 -0
  161. data/sentry-ruby/lib/sentry.rb +16 -0
  162. data/sentry-ruby/lib/sentry/backtrace.rb +128 -0
  163. data/sentry-ruby/lib/sentry/client.rb +162 -0
  164. data/sentry-ruby/lib/sentry/client/state.rb +40 -0
  165. data/sentry-ruby/lib/sentry/configuration.rb +533 -0
  166. data/sentry-ruby/lib/sentry/event.rb +209 -0
  167. data/sentry-ruby/lib/sentry/interface.rb +31 -0
  168. data/sentry-ruby/lib/sentry/interfaces/exception.rb +15 -0
  169. data/sentry-ruby/lib/sentry/interfaces/http.rb +16 -0
  170. data/sentry-ruby/lib/sentry/interfaces/message.rb +18 -0
  171. data/sentry-ruby/lib/sentry/interfaces/single_exception.rb +14 -0
  172. data/sentry-ruby/lib/sentry/interfaces/stack_trace.rb +69 -0
  173. data/sentry-ruby/lib/sentry/linecache.rb +44 -0
  174. data/sentry-ruby/lib/sentry/logger.rb +20 -0
  175. data/sentry-ruby/lib/sentry/transports.rb +19 -0
  176. data/sentry-ruby/lib/sentry/transports/dummy.rb +16 -0
  177. data/sentry-ruby/lib/sentry/transports/http.rb +66 -0
  178. data/sentry-ruby/lib/sentry/transports/stdout.rb +20 -0
  179. data/sentry-ruby/lib/sentry/utils/deep_merge.rb +22 -0
  180. data/sentry-ruby/lib/sentry/utils/exception_cause_chain.rb +20 -0
  181. data/sentry-ruby/lib/sentry/version.rb +3 -0
  182. data/sentry-ruby/sentry-ruby.gemspec +26 -0
  183. data/sentry-ruby/spec/sentry/backtrace_spec.rb +38 -0
  184. data/sentry-ruby/spec/sentry/client_spec.rb +443 -0
  185. data/sentry-ruby/spec/sentry/configuration_spec.rb +400 -0
  186. data/sentry-ruby/spec/sentry/event_spec.rb +238 -0
  187. data/sentry-ruby/spec/sentry/interface_spec.rb +38 -0
  188. data/sentry-ruby/spec/sentry/interfaces/stack_trace_spec.rb +11 -0
  189. data/sentry-ruby/spec/sentry/linecache_spec.rb +40 -0
  190. data/sentry-ruby/spec/sentry/transports/http_spec.rb +57 -0
  191. data/sentry-ruby/spec/sentry/transports/stdout_spec.rb +11 -0
  192. data/sentry-ruby/spec/sentry_spec.rb +9 -0
  193. data/sentry-ruby/spec/spec_helper.rb +49 -0
  194. data/sentry-ruby/spec/support/linecache.txt +6 -0
  195. metadata +160 -31
  196. data/.travis.yml +0 -47
  197. data/docs/Makefile +0 -130
  198. data/docs/breadcrumbs.rst +0 -51
  199. data/docs/conf.py +0 -228
  200. data/docs/config.rst +0 -260
  201. data/docs/context.rst +0 -141
  202. data/docs/index.rst +0 -113
  203. data/docs/install.rst +0 -40
  204. data/docs/integrations/heroku.rst +0 -11
  205. data/docs/integrations/index.rst +0 -59
  206. data/docs/integrations/puma.rst +0 -30
  207. data/docs/integrations/rack.rst +0 -27
  208. data/docs/integrations/rails.rst +0 -62
  209. data/docs/make.bat +0 -155
  210. data/docs/processors.rst +0 -124
  211. data/docs/sentry-doc-config.json +0 -31
  212. data/docs/usage.rst +0 -176
data/docs/config.rst DELETED
@@ -1,260 +0,0 @@
1
- Configuration
2
- =============
3
-
4
- Configuration is passed as part of the client initialization:
5
-
6
- .. code-block:: javascript
7
-
8
- Raven.configure do |config|
9
- config.dsn = '___DSN___'
10
- config.attr = 'value'
11
- end
12
-
13
- Optional settings
14
- -----------------
15
-
16
- .. describe:: async
17
-
18
- When an error or message occurs, the notification is immediately sent to Sentry. Raven can be configured to send asynchronously:
19
-
20
- .. code-block:: ruby
21
-
22
- config.async = lambda { |event|
23
- Thread.new { Raven.send_event(event) }
24
- }
25
-
26
- Using a thread to send events will be adequate for truly parallel Ruby platforms such as JRuby, though the benefit on MRI/CRuby will be limited.
27
-
28
- The example above is extremely basic. For example, exceptions in Rake tasks
29
- will not be reported because the Rake task will probably exit before the thread
30
- can completely send the event to Sentry. Threads also won't report any
31
- exceptions raised inside of them, so be careful!
32
-
33
- If the async callback raises an exception, Raven will attempt to send synchronously.
34
-
35
- We recommend creating a background job, using your background job processor, that will send Sentry notifications in the background. Rather than enqueuing an entire Raven::Event object, we recommend providing the Hash representation of an event as a job argument. Here's an example for ActiveJob:
36
-
37
- .. code-block:: ruby
38
-
39
- config.async = lambda { |event|
40
- SentryJob.perform_later(event.to_hash)
41
- }
42
-
43
- .. code-block:: ruby
44
-
45
- class SentryJob < ActiveJob::Base
46
- queue_as :default
47
-
48
- def perform(event)
49
- Raven.send_event(event)
50
- end
51
- end
52
-
53
- .. describe:: encoding
54
-
55
- While unlikely that you'll need to change it, by default Raven compresses outgoing messages with gzip. This has a slight impact on performance, but due to the size of many Ruby stacktrace it's required for the serve to accept the content.
56
-
57
- To disable gzip, set the encoding to 'json':
58
-
59
- .. code-block:: ruby
60
-
61
- config.encoding = 'json'
62
-
63
- .. describe:: environments
64
-
65
- As of v0.10.0, events will be sent to Sentry in all environments. If you do not wish to send events in an environment, we suggest you unset the SENTRY_DSN variable in that environment.
66
-
67
- Alternately, you can configure Raven to run only in certain environments by configuring the environments whitelist. For example, to only run Sentry in production:
68
-
69
- .. code-block:: ruby
70
-
71
- config.environments = %w[ production ]
72
-
73
- Sentry automatically sets the current environment to RAILS_ENV, or if it is not present, RACK_ENV. If you are using Sentry outside of Rack or Rails, or wish to override environment detection, you'll need to set the current environment by setting SENTRY_CURRENT_ENV or configuring the client yourself:
74
-
75
- .. code-block:: ruby
76
-
77
- config.current_environment = 'my_cool_environment'
78
-
79
- .. describe:: excluded_exceptions
80
-
81
- If you never wish to be notified of certain exceptions, specify 'excluded_exceptions' in your config file.
82
-
83
- In the example below, the exceptions Rails uses to generate 404 responses will be suppressed.
84
-
85
- .. code-block:: ruby
86
-
87
- config.excluded_exceptions += ['ActionController::RoutingError', 'ActiveRecord::RecordNotFound']
88
-
89
- You can find the list of exceptions that are excluded by default in ``Raven::Configuration::IGNORE_DEFAULT``. It is suggested that you append to these defaults rather than overwrite them with ``=``.
90
-
91
- .. describe:: logger
92
-
93
- The logger used by Sentry. Default is an instance of Raven::Logger.
94
-
95
- .. code-block:: ruby
96
-
97
- config.logger = Raven::Logger.new(STDOUT)
98
-
99
- Raven respects logger levels.
100
-
101
- .. describe:: processors
102
-
103
- If you need to sanitize or pre-process (before its sent to the server) data, you can do so using the Processors implementation. By default, a few processors are installed. The most important is ``Raven::Processor::SanitizeData``, which will attempt to sanitize keys that match various patterns (e.g. password) and values that resemble credit card numbers.
104
-
105
- In your Sentry UI, data which has been sanitized will appear as "********" (or 0, if the value was an Integer).
106
-
107
- To specify your own (or to remove the defaults), simply pass them with your configuration:
108
-
109
- .. code-block:: ruby
110
-
111
- config.processors = [MyOwnProcessor]
112
-
113
- Check out ``Raven::Processor::SanitizeData`` to see how a Processor is implemented.
114
-
115
- You can also specify values to be sanitized. Any strings matched will be replaced with the string mask (********). One good use for this is to copy Rails' filter_parameters:
116
-
117
- .. code-block:: ruby
118
-
119
- config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
120
-
121
- The client scrubs the HTTP "Authorization" header of requests before sending them to Sentry, to prevent sensitive credentials from being sent. You can specify additional HTTP headers to ignore:
122
-
123
- You can also provide regex-like strings to the sanitizer:
124
-
125
- .. code-block:: ruby
126
-
127
- config.sanitize_fields = ["my_field", "foo(.*)?bar]
128
-
129
- It's also possible to remove HTTP header values which match a list:
130
-
131
- .. code-block:: ruby
132
-
133
- config.sanitize_http_headers = ["Via", "Referer", "User-Agent", "Server", "From"]
134
-
135
- For more information about HTTP headers which may contain sensitive information in your application, see `RFC 2616 <https://www.w3.org/Protocols/rfc2616/rfc2616-sec15.html>`_.
136
-
137
- By default, Sentry sends up a stacktrace with an exception. This stacktrace may contain data which you may consider to be sensitive, including lines of source code, line numbers, module names, and source paths. To wipe the stacktrace from all error reports, require and add the RemoveStacktrace processor:
138
-
139
- .. code-block:: ruby
140
-
141
- require 'raven/processor/removestacktrace'
142
-
143
- Raven.configure do |config|
144
- config.processors << Raven::Processor::RemoveStacktrace
145
- end
146
-
147
- By default, Sentry does not send POST data or cookies if present. To re-enable, remove the respective processor from the chain:
148
-
149
- .. code-block:: ruby
150
-
151
- Raven.configure do |config|
152
- config.processors -= [Raven::Processor::PostData] # Do this to send POST data
153
- config.processors -= [Raven::Processor::Cookies] # Do this to send cookies by default
154
- end
155
-
156
- .. describe:: proxy
157
-
158
- A string with the URL of the HTTP proxy to be used.
159
-
160
- .. code-block:: ruby
161
-
162
- config.proxy = 'http://path.to.my.proxy.com'
163
-
164
- .. describe:: rails_report_rescued_exceptions
165
-
166
- Rails catches exceptions in the ActionDispatch::ShowExceptions or ActionDispatch::DebugExceptions middlewares, depending on the environment. When `rails_report_rescued_exceptions` is true (it is by default), Raven will report exceptions even when they are rescued by these middlewares.
167
-
168
- If you are using a custom exceptions app, you may wish to disable this behavior:
169
-
170
- .. code-block:: ruby
171
-
172
- config.rails_report_rescued_exceptions = false
173
-
174
- .. describe:: release
175
-
176
- Track the version of your application in Sentry.
177
-
178
- We guess the release intelligently in the following order of preference:
179
-
180
- * Commit SHA of the last commit (git)
181
- * Reading from the REVISION file in the app root
182
- * Heroku's dyno metadata (must have enabled via Heroku Labs)
183
-
184
- .. code-block:: ruby
185
-
186
- config.release = '721e41770371db95eee98ca2707686226b993eda'
187
-
188
- .. describe:: sample_rate
189
-
190
- The sampling factor to apply to events. A value of 0.00 will deny sending
191
- any events, and a value of 1.00 will send 100% of events.
192
-
193
- .. code-block:: ruby
194
-
195
- # send 50% of events
196
- config.sample_rate = 0.5
197
-
198
- .. describe:: should_capture
199
-
200
- By providing a proc or lambda, you can control what events are captured. A String (if you've captured a message) or the Exception (if you've captured an exception) will be passed to the Proc or lambda you provide - returning false will stop the event from sending to Sentry:
201
-
202
- .. code-block:: ruby
203
-
204
- config.should_capture = Proc.new { |e| true unless e.contains_sensitive_info? }
205
-
206
- .. describe:: silence_ready
207
-
208
- Upon start, Raven will write the following message to the log at the INFO level:
209
-
210
- ``
211
- ** [out :: hostname.example.com] I, [2014-07-22T15:32:57.498368 #30897] INFO -- : ** [Raven] Raven 0.9.4 ready to catch errors"
212
- ``
213
-
214
- You can turn off this message:
215
-
216
- .. code-block:: ruby
217
-
218
- config.silence_ready = true
219
-
220
- .. describe:: ssl_verification
221
-
222
- By default SSL certificate verification is enabled in the client. It can be disabled.
223
-
224
- .. code-block:: ruby
225
-
226
- config.ssl_verification = false
227
-
228
- .. describe:: tags
229
-
230
- Default tags to send with each event.
231
-
232
- .. code-block:: ruby
233
-
234
- config.tags = { foo: :bar }
235
-
236
- .. describe:: transport_failure_callback
237
-
238
- If the transport fails to send an event to Sentry for any reason (either the Sentry server has returned a 4XX or 5XX response), this Proc or lambda will be called.
239
-
240
- .. code-block:: ruby
241
-
242
- config.transport_failure_callback = lambda { |event|
243
- AdminMailer.email_admins("Oh god, it's on fire!").deliver_later
244
- }
245
-
246
- Environment Variables
247
- ---------------------
248
-
249
- .. describe:: SENTRY_DSN
250
-
251
- After you complete setting up a project, you'll be given a value which we call a DSN, or Data Source Name. It looks a lot like a standard URL, but it's actually just a representation of the configuration required by Raven (the Sentry client). It consists of a few pieces, including the protocol, public and secret keys, the server address, and the project identifier.
252
-
253
- With Raven, you may either set the SENTRY_DSN environment variable (recommended), or set your DSN manually in a config block:
254
-
255
- .. code-block:: ruby
256
-
257
- # in Rails, this might be in config/initializers/sentry.rb
258
- Raven.configure do |config|
259
- config.dsn = 'http://public:secret@example.com/project-id'
260
- end
data/docs/context.rst DELETED
@@ -1,141 +0,0 @@
1
- Context
2
- =======
3
-
4
- Additional context can be passed to the capture methods. This allows you
5
- to record extra information that could help you identify the root cause of
6
- the issue or who the error happened for.
7
-
8
- .. sourcecode:: ruby
9
-
10
- Raven.capture_message 'My Event!',
11
- logger: 'logger',
12
- extra: {
13
- my_custom_variable: 'value'
14
- },
15
- tags: {
16
- foo: 'bar'
17
- }
18
-
19
- The following attributes are available:
20
-
21
- * ``logger``: the logger name to record this event under
22
- * ``level``: a string representing the level of this event (fatal, error,
23
- warning, info, debug)
24
- * ``server_name``: the hostname of the server
25
- * ``tags``: a mapping of tags describing this event
26
- * ``extra``: a mapping of arbitrary context
27
- * ``user``: a mapping of user context
28
- * ``transaction``: An array of strings. The final element in the array represents the current transaction, e.g. "HelloController#hello_world" for a Rails controller.
29
-
30
- Providing Request Context
31
- -------------------------
32
-
33
- Most of the time you're not actually calling out to Raven directly, but
34
- you still want to provide some additional context. This lifecycle
35
- generally constists of something like the following:
36
-
37
- * Set some context via a middleware (e.g. the logged in user)
38
- * Send all given context with any events during the request lifecycle
39
- * Cleanup context
40
-
41
- There are three primary methods for providing request context.
42
-
43
- User Context
44
- ~~~~~~~~~~~~
45
-
46
- User context describes the current actor.
47
-
48
- .. sourcecode:: ruby
49
-
50
- # bind the logged in user
51
- Raven.user_context(
52
- # a unique ID which represents this user
53
- id: current_user.id, # 1
54
-
55
- # the actor's email address, if available
56
- email: current_user.email, # "example@example.org"
57
-
58
- # the actor's username, if available
59
- username: current_user.username, # "foo"
60
-
61
- # the actor's IP address, if available
62
- ip_address: request.ip # '127.0.0.1'
63
- )
64
-
65
- When dealing with anonymous users you will still want to send basic user context to ensure Sentry can count them against the unique users:
66
-
67
- .. sourcecode:: ruby
68
-
69
- Raven.user_context(
70
- # the actor's IP address, if available
71
- ip_address: request.ip # '127.0.0.1'
72
- )
73
-
74
- Tags
75
- ~~~~
76
-
77
- You can provide a set of key/value pairs called tags which Sentry will index and aggregate. This will help you understand the distribution of issues, as well as enabling easy lookup via search.
78
-
79
- .. sourcecode:: ruby
80
-
81
- # tag the request with something interesting
82
- Raven.tags_context(
83
- language: I18n.locale, # "en-us"
84
- timezone: current_user.time_zone # "PST"
85
- )
86
-
87
-
88
- Additional Context
89
- ~~~~~~~~~~~~~~~~~~
90
-
91
- In addition to the supported structured data of Sentry, you can provide additional context. This is a key/value mapping, where the values must be JSON compatible, but can be of a rich datatype.
92
-
93
- .. sourcecode:: ruby
94
-
95
- # provide a bit of additional context
96
- Raven.extra_context(
97
- happiness: 'very',
98
- emoji: ['much']
99
- )
100
-
101
- Rack (HTTP) Context
102
- ~~~~~~~~~~~~~~~~~~~
103
-
104
- Additionally, if you're using Rack (without the middleware), you can
105
- easily provide context with the ``rack_context`` helper:
106
-
107
- .. sourcecode:: ruby
108
-
109
- Raven.rack_context(env)
110
-
111
- If you're using the Rack middleware, we've already taken care of cleanup
112
- for you, otherwise you'll need to ensure you perform it manually:
113
-
114
- .. sourcecode:: ruby
115
-
116
- Raven::Context.clear!
117
-
118
- Note: the rack and user context will perform a set operation, whereas tags
119
- and extra context will merge with any existing request context.
120
-
121
- Transactions
122
- ~~~~~~~~~~~~
123
-
124
- The "transaction" is intended to represent the action the event occurred during.
125
- In Rack, this will be the request URL. In Rails, it's the controller name and
126
- action ("HelloController#hello_world").
127
-
128
- Transactions are modeled as a stack. The top item in the stack (i.e. the last
129
- element of the array) will be used as the ``transaction`` for any events:
130
-
131
- .. sourcecode:: ruby
132
-
133
- Raven.context.transaction.push "User Import"
134
- # import some users
135
- Raven.context.transaction.pop
136
-
137
- Transactions may also be overridden/set explicitly during event creation:
138
-
139
- .. sourcecode:: ruby
140
-
141
- Raven.capture_exception(exception, transaction: "User Import")
data/docs/index.rst DELETED
@@ -1,113 +0,0 @@
1
- .. sentry:edition:: self
2
-
3
- Raven Ruby
4
- ==========
5
-
6
- .. sentry:edition:: hosted, on-premise
7
-
8
- .. class:: platform-ruby
9
-
10
- Ruby
11
- ====
12
-
13
- Raven for Ruby is a client and integration layer for the Sentry error
14
- reporting API. It supports Ruby 1.9.3 and 2.x.
15
- JRuby support is provided but experimental.
16
-
17
- Installation
18
- ------------
19
-
20
- Raven Ruby comes as a gem and is straightforward to install. If you are
21
- using Bundler just add this to your ``Gemfile``:
22
-
23
- .. sourcecode:: ruby
24
-
25
- gem "sentry-raven"
26
-
27
- For other means of installation see :doc:`install`.
28
-
29
- Configuration
30
- -------------
31
-
32
- To use Raven Ruby all you need is your DSN. Like most Sentry libraries it
33
- will honor the ``SENTRY_DSN`` environment variable. You can find it on
34
- the project settings page under API Keys. You can either export it as
35
- environment variable or manually configure it with ``Raven.configure``:
36
-
37
- .. sourcecode:: ruby
38
-
39
- Raven.configure do |config|
40
- config.dsn = '___DSN___'
41
- end
42
-
43
- Reporting Failures
44
- ------------------
45
-
46
- If you use Rails, Rake, Sidekiq, etc, you're already done - no more
47
- configuration required! Check :doc:`integrations/index` for more details on
48
- other gems Sentry integrates with automatically.
49
-
50
- Rack requires a little more setup: :doc:`integrations/rack`
51
-
52
- Otherwise, Raven supports two methods of capturing exceptions:
53
-
54
- .. sourcecode:: ruby
55
-
56
- Raven.capture do
57
- # capture any exceptions which happen during execution of this block
58
- 1 / 0
59
- end
60
-
61
- begin
62
- 1 / 0
63
- rescue ZeroDivisionError => exception
64
- Raven.capture_exception(exception)
65
- end
66
-
67
- Additional Context
68
- ------------------
69
-
70
- Much of the usefulness of Sentry comes from additional context data with
71
- the events. Raven Ruby makes this very convenient by providing
72
- methods to set thread local context data that is then submitted
73
- automatically with all events.
74
-
75
- There are three primary methods for providing request context:
76
-
77
- .. sourcecode:: ruby
78
-
79
- # bind the logged in user
80
- Raven.user_context email: 'foo@example.com'
81
-
82
- # tag the request with something interesting
83
- Raven.tags_context interesting: 'yes'
84
-
85
- # provide a bit of additional context
86
- Raven.extra_context happiness: 'very'
87
-
88
- For more information see :doc:`context`.
89
-
90
- Deep Dive
91
- ---------
92
-
93
- Want to know more? We have a detailed documentation about all parts of
94
- the library and the client integrations.
95
-
96
-
97
- .. toctree::
98
- :maxdepth: 2
99
- :titlesonly:
100
-
101
- install
102
- config
103
- usage
104
-
105
- breadcrumbs
106
- context
107
- processors
108
- integrations/index
109
-
110
- Resources:
111
-
112
- * `Bug Tracker <http://github.com/getsentry/raven-ruby/issues>`_
113
- * `Github Project <http://github.com/getsentry/raven-ruby>`_