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.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.gitmodules +0 -3
- data/.rubocop.yml +1 -1
- data/.travis.yml +2 -2
- data/Gemfile +5 -5
- data/README.md +8 -4
- data/changelog.md +5 -0
- data/lib/raven/client.rb +9 -1
- data/lib/raven/configuration.rb +21 -6
- data/lib/raven/instance.rb +8 -4
- data/lib/raven/transports/stdout.rb +20 -0
- data/lib/raven/version.rb +1 -1
- data/sentry-raven.gemspec +0 -1
- metadata +4 -19
- data/docs/Makefile +0 -130
- data/docs/breadcrumbs.rst +0 -51
- data/docs/conf.py +0 -228
- data/docs/config.rst +0 -260
- data/docs/context.rst +0 -141
- data/docs/index.rst +0 -113
- data/docs/install.rst +0 -40
- data/docs/integrations/heroku.rst +0 -11
- data/docs/integrations/index.rst +0 -59
- data/docs/integrations/puma.rst +0 -30
- data/docs/integrations/rack.rst +0 -27
- data/docs/integrations/rails.rst +0 -62
- data/docs/make.bat +0 -155
- data/docs/processors.rst +0 -124
- data/docs/sentry-doc-config.json +0 -31
- data/docs/usage.rst +0 -176
data/docs/make.bat
DELETED
@@ -1,155 +0,0 @@
|
|
1
|
-
@ECHO OFF
|
2
|
-
|
3
|
-
REM Command file for Sphinx documentation
|
4
|
-
|
5
|
-
if "%SPHINXBUILD%" == "" (
|
6
|
-
set SPHINXBUILD=sphinx-build
|
7
|
-
)
|
8
|
-
set BUILDDIR=_build
|
9
|
-
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
|
10
|
-
if NOT "%PAPER%" == "" (
|
11
|
-
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
12
|
-
)
|
13
|
-
|
14
|
-
if "%1" == "" goto help
|
15
|
-
|
16
|
-
if "%1" == "help" (
|
17
|
-
:help
|
18
|
-
echo.Please use `make ^<target^>` where ^<target^> is one of
|
19
|
-
echo. html to make standalone HTML files
|
20
|
-
echo. dirhtml to make HTML files named index.html in directories
|
21
|
-
echo. singlehtml to make a single large HTML file
|
22
|
-
echo. pickle to make pickle files
|
23
|
-
echo. json to make JSON files
|
24
|
-
echo. htmlhelp to make HTML files and a HTML help project
|
25
|
-
echo. qthelp to make HTML files and a qthelp project
|
26
|
-
echo. devhelp to make HTML files and a Devhelp project
|
27
|
-
echo. epub to make an epub
|
28
|
-
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
29
|
-
echo. text to make text files
|
30
|
-
echo. man to make manual pages
|
31
|
-
echo. changes to make an overview over all changed/added/deprecated items
|
32
|
-
echo. linkcheck to check all external links for integrity
|
33
|
-
echo. doctest to run all doctests embedded in the documentation if enabled
|
34
|
-
goto end
|
35
|
-
)
|
36
|
-
|
37
|
-
if "%1" == "clean" (
|
38
|
-
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
|
39
|
-
del /q /s %BUILDDIR%\*
|
40
|
-
goto end
|
41
|
-
)
|
42
|
-
|
43
|
-
if "%1" == "html" (
|
44
|
-
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
|
45
|
-
echo.
|
46
|
-
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
|
47
|
-
goto end
|
48
|
-
)
|
49
|
-
|
50
|
-
if "%1" == "dirhtml" (
|
51
|
-
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
|
52
|
-
echo.
|
53
|
-
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
|
54
|
-
goto end
|
55
|
-
)
|
56
|
-
|
57
|
-
if "%1" == "singlehtml" (
|
58
|
-
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
|
59
|
-
echo.
|
60
|
-
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
|
61
|
-
goto end
|
62
|
-
)
|
63
|
-
|
64
|
-
if "%1" == "pickle" (
|
65
|
-
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
|
66
|
-
echo.
|
67
|
-
echo.Build finished; now you can process the pickle files.
|
68
|
-
goto end
|
69
|
-
)
|
70
|
-
|
71
|
-
if "%1" == "json" (
|
72
|
-
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
|
73
|
-
echo.
|
74
|
-
echo.Build finished; now you can process the JSON files.
|
75
|
-
goto end
|
76
|
-
)
|
77
|
-
|
78
|
-
if "%1" == "htmlhelp" (
|
79
|
-
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
|
80
|
-
echo.
|
81
|
-
echo.Build finished; now you can run HTML Help Workshop with the ^
|
82
|
-
.hhp project file in %BUILDDIR%/htmlhelp.
|
83
|
-
goto end
|
84
|
-
)
|
85
|
-
|
86
|
-
if "%1" == "qthelp" (
|
87
|
-
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
|
88
|
-
echo.
|
89
|
-
echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
90
|
-
.qhcp project file in %BUILDDIR%/qthelp, like this:
|
91
|
-
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Sentry.qhcp
|
92
|
-
echo.To view the help file:
|
93
|
-
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Sentry.ghc
|
94
|
-
goto end
|
95
|
-
)
|
96
|
-
|
97
|
-
if "%1" == "devhelp" (
|
98
|
-
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
|
99
|
-
echo.
|
100
|
-
echo.Build finished.
|
101
|
-
goto end
|
102
|
-
)
|
103
|
-
|
104
|
-
if "%1" == "epub" (
|
105
|
-
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
|
106
|
-
echo.
|
107
|
-
echo.Build finished. The epub file is in %BUILDDIR%/epub.
|
108
|
-
goto end
|
109
|
-
)
|
110
|
-
|
111
|
-
if "%1" == "latex" (
|
112
|
-
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
113
|
-
echo.
|
114
|
-
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
|
115
|
-
goto end
|
116
|
-
)
|
117
|
-
|
118
|
-
if "%1" == "text" (
|
119
|
-
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
|
120
|
-
echo.
|
121
|
-
echo.Build finished. The text files are in %BUILDDIR%/text.
|
122
|
-
goto end
|
123
|
-
)
|
124
|
-
|
125
|
-
if "%1" == "man" (
|
126
|
-
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
|
127
|
-
echo.
|
128
|
-
echo.Build finished. The manual pages are in %BUILDDIR%/man.
|
129
|
-
goto end
|
130
|
-
)
|
131
|
-
|
132
|
-
if "%1" == "changes" (
|
133
|
-
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
|
134
|
-
echo.
|
135
|
-
echo.The overview file is in %BUILDDIR%/changes.
|
136
|
-
goto end
|
137
|
-
)
|
138
|
-
|
139
|
-
if "%1" == "linkcheck" (
|
140
|
-
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
|
141
|
-
echo.
|
142
|
-
echo.Link check complete; look for any errors in the above output ^
|
143
|
-
or in %BUILDDIR%/linkcheck/output.txt.
|
144
|
-
goto end
|
145
|
-
)
|
146
|
-
|
147
|
-
if "%1" == "doctest" (
|
148
|
-
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
|
149
|
-
echo.
|
150
|
-
echo.Testing of doctests in the sources finished, look at the ^
|
151
|
-
results in %BUILDDIR%/doctest/output.txt.
|
152
|
-
goto end
|
153
|
-
)
|
154
|
-
|
155
|
-
:end
|
data/docs/processors.rst
DELETED
@@ -1,124 +0,0 @@
|
|
1
|
-
Processors
|
2
|
-
==========
|
3
|
-
|
4
|
-
Raven Ruby contains several "processors", which scrub data before it is sent to Sentry.
|
5
|
-
Processors remove invalid or sensitive data. The following are the processors
|
6
|
-
which are enabled by default (and are applied to all outgoing data in this order):
|
7
|
-
|
8
|
-
RemoveCircularReferences
|
9
|
-
Many Ruby JSON implementations simply throw an exception if they detect a
|
10
|
-
circular reference. This processor removes circular references from hashes
|
11
|
-
and arrays.
|
12
|
-
|
13
|
-
UTF8Conversion
|
14
|
-
Many Ruby JSON implementations will throw exceptions if data is not in a
|
15
|
-
consistent UTF-8 format. This processor looks for invalid encodings and fixes
|
16
|
-
them.
|
17
|
-
|
18
|
-
SanitizeData
|
19
|
-
Censors any data which looks like a password, social security number or credit
|
20
|
-
card number. Can be configured to scrub other data.
|
21
|
-
|
22
|
-
Cookies
|
23
|
-
Removes any HTTP cookies from the Sentry event data.
|
24
|
-
|
25
|
-
PostData
|
26
|
-
Removes any HTTP Post request bodies.
|
27
|
-
|
28
|
-
HTTPHeaders
|
29
|
-
Removes all HTTP headers which match a regex. By default, this will only remove the
|
30
|
-
"Authorization" header, but can be configured to remove others.
|
31
|
-
|
32
|
-
Finally, another processor is included in the source but is not turned on by default,
|
33
|
-
RemoveStackTrace.
|
34
|
-
|
35
|
-
To remove stacktraces from events:
|
36
|
-
|
37
|
-
.. sourcecode:: ruby
|
38
|
-
|
39
|
-
Raven.configure do |config|
|
40
|
-
config.processors += [Raven::Processor::RemoveStacktrace]
|
41
|
-
end
|
42
|
-
|
43
|
-
Writing Your Own Processor
|
44
|
-
--------------------------
|
45
|
-
|
46
|
-
Processors are simple to write and understand. As an example, let's say that we
|
47
|
-
send user API keys to a background job (using Sidekiq), and if the background job
|
48
|
-
raises an exception, we want to make sure that the API key is removed from the
|
49
|
-
event data.
|
50
|
-
|
51
|
-
This is what a basic processor might look like:
|
52
|
-
|
53
|
-
.. sourcecode:: ruby
|
54
|
-
|
55
|
-
class MyJobProcessor < Raven::Processor
|
56
|
-
def process(data)
|
57
|
-
return data unless data["extra"]["arguments"] &&
|
58
|
-
data["extra"]["arguments"].first["sensitive_parameter"]
|
59
|
-
|
60
|
-
data["extra"]["arguments"].first["sensitive_parameter"] = STRING_MASK
|
61
|
-
data
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
Processors should inherit from the ``Raven::Processor`` class. This ensures that the
|
66
|
-
processor has access to its client (all processors have a ``client`` instance method,
|
67
|
-
which will be populated with the current ``Raven::Client`` when the processor
|
68
|
-
is initialized), and gives you a few convenient constants for masking data.
|
69
|
-
|
70
|
-
Processors must have a method called ``process`` defined. It must accept one
|
71
|
-
argument, which will be the Raven event data hash. The method must return a hash,
|
72
|
-
which represents the data after it has been modified by the processor.
|
73
|
-
|
74
|
-
To help you in writing your own processor, here is what the Event data hash looks
|
75
|
-
like (slightly modified/concatenated) when it is passed to the processor:
|
76
|
-
|
77
|
-
.. sourcecode:: ruby
|
78
|
-
|
79
|
-
{
|
80
|
-
"environment" => "default",
|
81
|
-
"event_id" => "02ea6d3d35c840b1a8f339ba896917e3",
|
82
|
-
"extra" => {
|
83
|
-
"server" => {
|
84
|
-
# server related information
|
85
|
-
}
|
86
|
-
"active_job" => "MyActiveJob",
|
87
|
-
"arguments" => [ {"sensitive_parameter": "sensitive"} ],
|
88
|
-
"job_id" => "cbc2c146-0486-4e98-b81c-1a251d636b34",
|
89
|
-
},
|
90
|
-
"modules" => {
|
91
|
-
"rake"=>"12.0.0",
|
92
|
-
"concurrent-ruby"=>"1.0.5",
|
93
|
-
"i18n"=>"0.8.6",
|
94
|
-
"minitest"=>"5.10.3",
|
95
|
-
# ...
|
96
|
-
},
|
97
|
-
"platform" => "ruby",
|
98
|
-
"release" => "e4d5ced",
|
99
|
-
"sdk" => {"name"=>"raven-ruby", "version"=>"2.6.3"},
|
100
|
-
"server_name" => "myserver.local",
|
101
|
-
"timestamp" => "2017-10-09T19:53:20",
|
102
|
-
"exception" => {
|
103
|
-
# A very large and complex exception object
|
104
|
-
}
|
105
|
-
}
|
106
|
-
|
107
|
-
However, it will probably be more helpful if you use a debugger, such as `pry`, to
|
108
|
-
inspect the event data hash for yourself.
|
109
|
-
|
110
|
-
The example processor given above looks for the ActiveJob arguments hash, looks for
|
111
|
-
a particular value, and then replaces it with the string mask. There is a fast return
|
112
|
-
if the event does not contain the ActiveJob data we're looking for, using Ruby 2.3+'s
|
113
|
-
safe navigation operator.
|
114
|
-
|
115
|
-
Once you have your processor written, you simply need to add it to the processor chain:
|
116
|
-
|
117
|
-
.. sourcecode:: ruby
|
118
|
-
|
119
|
-
Raven.configure do |config|
|
120
|
-
config.processors += MyJobProcessor
|
121
|
-
end
|
122
|
-
|
123
|
-
For more information about writing processors, read the code for the default
|
124
|
-
processors, located in ``lib/processor``.
|
data/docs/sentry-doc-config.json
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"support_level": "production",
|
3
|
-
"platforms": {
|
4
|
-
"ruby": {
|
5
|
-
"name": "Ruby",
|
6
|
-
"type": "language",
|
7
|
-
"doc_link": "",
|
8
|
-
"wizard": [
|
9
|
-
"index#installation",
|
10
|
-
"index#configuration",
|
11
|
-
"index#reporting-failures"
|
12
|
-
]
|
13
|
-
},
|
14
|
-
"ruby.rack": {
|
15
|
-
"name": "Rack",
|
16
|
-
"type": "framework",
|
17
|
-
"doc_link": "integrations/rack/",
|
18
|
-
"wizard": [
|
19
|
-
"integrations/rack#rack-sinatra-etc"
|
20
|
-
]
|
21
|
-
},
|
22
|
-
"ruby.rails": {
|
23
|
-
"name": "Rails",
|
24
|
-
"type": "framework",
|
25
|
-
"doc_link": "integrations/rails/",
|
26
|
-
"wizard": [
|
27
|
-
"integrations/rails#ruby-on-rails"
|
28
|
-
]
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
data/docs/usage.rst
DELETED
@@ -1,176 +0,0 @@
|
|
1
|
-
Usage
|
2
|
-
=====
|
3
|
-
|
4
|
-
To use Raven Ruby all you need is your DSN. Like most Sentry libraries it
|
5
|
-
will honor the ``SENTRY_DSN`` environment variable. You can find it on
|
6
|
-
the project settings page under API Keys. You can either export it as
|
7
|
-
environment variable or manually configure it with ``Raven.configure``:
|
8
|
-
|
9
|
-
.. code-block:: ruby
|
10
|
-
|
11
|
-
Raven.configure do |config|
|
12
|
-
config.dsn = '___DSN___'
|
13
|
-
end
|
14
|
-
|
15
|
-
If you only want to send events to Sentry in certain environments, you
|
16
|
-
should set ``config.environments`` too:
|
17
|
-
|
18
|
-
.. code-block:: ruby
|
19
|
-
|
20
|
-
Raven.configure do |config|
|
21
|
-
config.dsn = '___DSN___'
|
22
|
-
config.environments = ['staging', 'production']
|
23
|
-
end
|
24
|
-
|
25
|
-
Reporting Failures
|
26
|
-
------------------
|
27
|
-
|
28
|
-
If you use Rails, Rake, Rack etc, you're already done - no more
|
29
|
-
configuration required! Check :doc:`integrations/index` for more details on
|
30
|
-
other gems Sentry integrates with automatically.
|
31
|
-
|
32
|
-
Otherwise, Raven supports two methods of capturing exceptions:
|
33
|
-
|
34
|
-
.. sourcecode:: ruby
|
35
|
-
|
36
|
-
Raven.capture do
|
37
|
-
# capture any exceptions which happen during execution of this block
|
38
|
-
1 / 0
|
39
|
-
end
|
40
|
-
|
41
|
-
begin
|
42
|
-
1 / 0
|
43
|
-
rescue ZeroDivisionError => exception
|
44
|
-
Raven.capture_exception(exception)
|
45
|
-
end
|
46
|
-
|
47
|
-
Reporting Messages
|
48
|
-
------------------
|
49
|
-
|
50
|
-
If you want to report a message rather than an exception you can use the
|
51
|
-
``capture_message`` method:
|
52
|
-
|
53
|
-
.. code-block:: ruby
|
54
|
-
|
55
|
-
Raven.capture_message("Something went very wrong")
|
56
|
-
|
57
|
-
Referencing Events
|
58
|
-
------------------
|
59
|
-
|
60
|
-
The client exposes a ``last_event_id`` accessor allowing you to easily
|
61
|
-
reference the last captured event. This is useful, for example, if you wanted
|
62
|
-
to show the user a reference on your error page:
|
63
|
-
|
64
|
-
.. code-block:: ruby
|
65
|
-
|
66
|
-
# somewhere deep in the stack
|
67
|
-
Raven.capture do
|
68
|
-
1 / 0
|
69
|
-
end
|
70
|
-
|
71
|
-
Now you can easily expose this to your error handler:
|
72
|
-
|
73
|
-
.. code-block:: ruby
|
74
|
-
|
75
|
-
class ErrorsController < ApplicationController
|
76
|
-
def internal_server_error
|
77
|
-
render(:status => 500, :sentry_event_id => Raven.last_event_id)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
Optional Attributes
|
82
|
-
-------------------
|
83
|
-
|
84
|
-
With calls to ``capture_exception`` or ``capture_message`` additional data
|
85
|
-
can be supplied:
|
86
|
-
|
87
|
-
.. code-block:: ruby
|
88
|
-
|
89
|
-
Raven.capture_message("...", :attr => 'value')
|
90
|
-
|
91
|
-
.. describe:: extra
|
92
|
-
|
93
|
-
Additional context for this event. Must be a mapping. Children can be any native JSON type.
|
94
|
-
|
95
|
-
.. code-block:: ruby
|
96
|
-
|
97
|
-
{
|
98
|
-
:extra => {'key' => 'value'}
|
99
|
-
}
|
100
|
-
|
101
|
-
.. describe:: fingerprint
|
102
|
-
|
103
|
-
The fingerprint for grouping this event.
|
104
|
-
|
105
|
-
.. code-block:: ruby
|
106
|
-
|
107
|
-
{
|
108
|
-
:fingerprint => ['{{ default }}', 'other value']
|
109
|
-
}
|
110
|
-
|
111
|
-
.. describe:: level
|
112
|
-
|
113
|
-
The level of the event. Defaults to ``error``.
|
114
|
-
|
115
|
-
.. code-block:: ruby
|
116
|
-
|
117
|
-
{
|
118
|
-
:level => 'warning'
|
119
|
-
}
|
120
|
-
|
121
|
-
Sentry is aware of the following levels:
|
122
|
-
|
123
|
-
* debug (the least serious)
|
124
|
-
* info
|
125
|
-
* warning
|
126
|
-
* error
|
127
|
-
* fatal (the most serious)
|
128
|
-
|
129
|
-
.. describe:: logger
|
130
|
-
|
131
|
-
The logger name for the event.
|
132
|
-
|
133
|
-
.. code-block:: ruby
|
134
|
-
|
135
|
-
{
|
136
|
-
:logger => 'default'
|
137
|
-
}
|
138
|
-
|
139
|
-
.. describe:: tags
|
140
|
-
|
141
|
-
Tags to index with this event. Must be a mapping of strings.
|
142
|
-
|
143
|
-
.. code-block:: ruby
|
144
|
-
|
145
|
-
{
|
146
|
-
:tags => {'key' => 'value'}
|
147
|
-
}
|
148
|
-
|
149
|
-
.. describe:: user
|
150
|
-
|
151
|
-
The acting user.
|
152
|
-
|
153
|
-
.. code-block:: ruby
|
154
|
-
|
155
|
-
{
|
156
|
-
:user => {
|
157
|
-
'id' => 42,
|
158
|
-
'email' => 'clever-girl'
|
159
|
-
}
|
160
|
-
}
|
161
|
-
|
162
|
-
Many Instances
|
163
|
-
--------------
|
164
|
-
|
165
|
-
It is possible to have many different instances and configurations of the Raven
|
166
|
-
client running at once. See the delegation pattern in ``base.rb`` for more
|
167
|
-
information about how the ``Raven`` module delegates calls to the "main" instance.
|
168
|
-
|
169
|
-
.. code-block:: ruby
|
170
|
-
|
171
|
-
Raven.capture # capture, sent to the main instance
|
172
|
-
|
173
|
-
# You can create as many instances as you like. Provide a context and config.
|
174
|
-
instance = Raven::Instance.new(Raven::Context.new, Raven::Configuration.new)
|
175
|
-
|
176
|
-
Currently, all integrations use the "main" instance.
|