sentry-raven 2.7.4 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,51 +0,0 @@
1
- .. versionadded:: 1.2
2
-
3
- Breadcrumbs
4
- ===========
5
-
6
- Breadcrumbs are a trail of events which happened prior to an issue. Often, these events are very similar to traditional logs, but Breadcrumbs also can record rich, structured data.
7
-
8
- .. sourcecode:: ruby
9
-
10
- Raven.breadcrumbs.record do |crumb|
11
- crumb.data = data
12
- crumb.category = name
13
- # ...
14
- end
15
-
16
- The following attributes are available:
17
-
18
- * ``category``: A String to label the event under. This will usually be the same as a logger name, and will let you more easily understand the area an event took place, such as "auth".
19
- * ``data``: A Hash of metadata around the event. This is often used instead of message, but may also be used in addition.
20
- * ``level``: The level may be any of ``error``, ``warn``, ``info``, or ``debug``.
21
- * ``message``: A string describing the event. The most common vector, often used as a drop-in for a traditional log message.
22
- * ``timestamp``: A Unix timestamp (seconds past epoch)
23
-
24
- Appropriate places to inject Breadcrumbs may be places like your HTTP library:
25
-
26
- .. sourcecode:: ruby
27
-
28
- # Instrumenting Faraday with a middleware:
29
-
30
- class RavenFaradayMiddleware
31
- def call
32
- # Add a breadcrumb every time we complete an HTTP request
33
- @app.call(request_env).on_complete do |response_env|
34
- Raven.breadcrumbs.record do |crumb|
35
- crumb.data = { response_env: response_env }
36
- crumb.category = "faraday"
37
- crumb.timestamp = Time.now.to_i
38
- crumb.message = "Completed request to #{request_env[:url]}"
39
- end
40
- end
41
- end
42
- end
43
-
44
- .. versionadded:: 2.6
45
-
46
- The breadcrumb buffer is publicly accessible if you wish to manipulate it beyond
47
- what is possible with the ``record`` method.
48
-
49
- .. sourcecode:: ruby
50
-
51
- Raven.breadcrumbs.buffer # Array of breadcrumbs
@@ -1,228 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Sentry documentation build configuration file, created by
4
- # sphinx-quickstart on Wed Oct 20 16:21:42 2010.
5
- #
6
- # This file is execfile()d with the current directory set to its containing dir.
7
- #
8
- # Note that not all possible configuration values are present in this
9
- # autogenerated file.
10
- #
11
- # All configuration values have a default; values that are commented out
12
- # serve to show the default.
13
-
14
- import os
15
- import sys
16
- import datetime
17
-
18
- # If extensions (or modules to document with autodoc) are in another directory,
19
- # add these directories to sys.path here. If the directory is relative to the
20
- # documentation root, use os.path.abspath to make it absolute, like shown here.
21
- #sys.path.insert(0, os.path.abspath('.'))
22
-
23
- # -- General configuration -----------------------------------------------------
24
-
25
- # If your documentation needs a minimal Sphinx version, state it here.
26
- #needs_sphinx = '1.0'
27
-
28
- # Add any Sphinx extension module names here, as strings. They can be extensions
29
- # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
30
- #extensions = ['sphinxtogithub']
31
- extensions = ['sphinx.ext.intersphinx']
32
-
33
- # Add any paths that contain templates here, relative to this directory.
34
- templates_path = ['_templates']
35
-
36
- # The suffix of source filenames.
37
- source_suffix = '.rst'
38
-
39
- # The encoding of source files.
40
- #source_encoding = 'utf-8-sig'
41
-
42
- # The master toctree document.
43
- master_doc = 'index'
44
-
45
- # General information about the project.
46
- project = u'Raven'
47
- copyright = u'%s, Functional Software Inc.' % datetime.datetime.today().year
48
-
49
- # The version info for the project you're documenting, acts as replacement for
50
- # |version| and |release|, also used in various other places throughout the
51
- # built documents.
52
- #
53
- # The short X.Y version.
54
-
55
- version = __import__('pkg_resources').get_distribution('raven').version
56
- # The full version, including alpha/beta/rc tags.
57
- release = version
58
-
59
- # The language for content autogenerated by Sphinx. Refer to documentation
60
- # for a list of supported languages.
61
- #language = None
62
-
63
- # There are two options for replacing |today|: either, you set today to some
64
- # non-false value, then it is used:
65
- #today = ''
66
- # Else, today_fmt is used as the format for a strftime call.
67
- #today_fmt = '%B %d, %Y'
68
-
69
- # List of patterns, relative to source directory, that match files and
70
- # directories to ignore when looking for source files.
71
- exclude_patterns = ['_build']
72
-
73
- # The reST default role (used for this markup: `text`) to use for all documents.
74
- #default_role = None
75
-
76
- # If true, '()' will be appended to :func: etc. cross-reference text.
77
- #add_function_parentheses = True
78
-
79
- # If true, the current module name will be prepended to all description
80
- # unit titles (such as .. function::).
81
- #add_module_names = True
82
-
83
- # If true, sectionauthor and moduleauthor directives will be shown in the
84
- # output. They are ignored by default.
85
- #show_authors = False
86
-
87
- # The name of the Pygments (syntax highlighting) style to use.
88
- pygments_style = 'sphinx'
89
-
90
- # A list of ignored prefixes for module index sorting.
91
- #modindex_common_prefix = []
92
-
93
- intersphinx_mapping = {
94
- }
95
-
96
-
97
- # -- Options for HTML output ---------------------------------------------------
98
-
99
- # The theme to use for HTML and HTML Help pages. See the documentation for
100
- # a list of builtin themes.
101
- html_theme = 'nature'
102
-
103
- # Theme options are theme-specific and customize the look and feel of a theme
104
- # further. For a list of options available for each theme, see the
105
- # documentation.
106
- # html_theme_options = {}
107
-
108
- # Add any paths that contain custom themes here, relative to this directory.
109
- html_theme_path = ['_themes']
110
-
111
- # The name for this set of Sphinx documents. If None, it defaults to
112
- # "<project> v<release> documentation".
113
- #html_title = None
114
-
115
- # A shorter title for the navigation bar. Default is the same as html_title.
116
- #html_short_title = None
117
-
118
- # The name of an image file (relative to this directory) to place at the top
119
- # of the sidebar.
120
- #html_logo = "_static/logo.png"
121
-
122
- # The name of an image file (within the static path) to use as favicon of the
123
- # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
124
- # pixels large.
125
- #html_favicon = None
126
-
127
- # Add any paths that contain custom static files (such as style sheets) here,
128
- # relative to this directory. They are copied after the builtin static files,
129
- # so a file named "default.css" will overwrite the builtin "default.css".
130
- html_static_path = ['_static']
131
-
132
- # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
133
- # using the given strftime format.
134
- #html_last_updated_fmt = '%b %d, %Y'
135
-
136
- # If true, SmartyPants will be used to convert quotes and dashes to
137
- # typographically correct entities.
138
- #html_use_smartypants = True
139
-
140
- # Custom sidebar templates, maps document names to template names.
141
- #html_sidebars = {}
142
-
143
- # Additional templates that should be rendered to pages, maps page names to
144
- # template names.
145
- #html_additional_pages = {}
146
-
147
- # If false, no module index is generated.
148
- #html_domain_indices = True
149
-
150
- # If false, no index is generated.
151
- #html_use_index = True
152
-
153
- # If true, the index is split into individual pages for each letter.
154
- #html_split_index = False
155
-
156
- # If true, links to the reST sources are added to the pages.
157
- #html_show_sourcelink = True
158
-
159
- # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
160
- #html_show_sphinx = True
161
-
162
- # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
163
- #html_show_copyright = True
164
-
165
- # If true, an OpenSearch description file will be output, and all pages will
166
- # contain a <link> tag referring to it. The value of this option must be the
167
- # base URL from which the finished HTML is served.
168
- #html_use_opensearch = ''
169
-
170
- # This is the file name suffix for HTML files (e.g. ".xhtml").
171
- #html_file_suffix = None
172
-
173
- # Output file base name for HTML help builder.
174
- htmlhelp_basename = 'Ravendoc'
175
-
176
-
177
- # -- Options for LaTeX output --------------------------------------------------
178
-
179
- # The paper size ('letter' or 'a4').
180
- #latex_paper_size = 'letter'
181
-
182
- # The font size ('10pt', '11pt' or '12pt').
183
- #latex_font_size = '10pt'
184
-
185
- # Grouping the document tree into LaTeX files. List of tuples
186
- # (source start file, target name, title, author, documentclass [howto/manual]).
187
- latex_documents = [
188
- ('index', 'Raven.tex', u'Raven Ruby Documentation',
189
- u'David Cramer', 'manual'),
190
- ]
191
-
192
- # The name of an image file (relative to this directory) to place at the top of
193
- # the title page.
194
- #latex_logo = None
195
-
196
- # For "manual" documents, if this is true, then toplevel headings are parts,
197
- # not chapters.
198
- #latex_use_parts = False
199
-
200
- # If true, show page references after internal links.
201
- #latex_show_pagerefs = False
202
-
203
- # If true, show URL addresses after external links.
204
- #latex_show_urls = False
205
-
206
- # Additional stuff for the LaTeX preamble.
207
- #latex_preamble = ''
208
-
209
- # Documents to append as an appendix to all manuals.
210
- #latex_appendices = []
211
-
212
- # If false, no module index is generated.
213
- #latex_domain_indices = True
214
-
215
-
216
- # -- Options for manual page output --------------------------------------------
217
-
218
- # One entry per manual page. List of tuples
219
- # (source start file, name, description, authors, manual section).
220
- man_pages = [
221
- ('index', 'raven', u'Raven Ruby Documentation',
222
- [u'Functional Software Inc.'], 1)
223
- ]
224
-
225
- if os.environ.get('SENTRY_FEDERATED_DOCS') != '1':
226
- sys.path.insert(0, os.path.abspath('_sentryext'))
227
- import sentryext
228
- sentryext.activate()
@@ -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