alec-gem 2.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +1 -0
  3. data/.rubocop.yml +74 -0
  4. data/.travis.yml +47 -0
  5. data/Gemfile +38 -0
  6. data/Gemfile.lock +215 -0
  7. data/LICENSE +201 -0
  8. data/README.md +132 -0
  9. data/Rakefile +29 -0
  10. data/alec-gem.gemspec +22 -0
  11. data/changelog.md +442 -0
  12. data/docs/Makefile +130 -0
  13. data/docs/breadcrumbs.rst +51 -0
  14. data/docs/conf.py +228 -0
  15. data/docs/config.rst +260 -0
  16. data/docs/context.rst +141 -0
  17. data/docs/index.rst +113 -0
  18. data/docs/install.rst +40 -0
  19. data/docs/integrations/heroku.rst +11 -0
  20. data/docs/integrations/index.rst +59 -0
  21. data/docs/integrations/puma.rst +30 -0
  22. data/docs/integrations/rack.rst +27 -0
  23. data/docs/integrations/rails.rst +62 -0
  24. data/docs/make.bat +155 -0
  25. data/docs/processors.rst +124 -0
  26. data/docs/sentry-doc-config.json +31 -0
  27. data/docs/usage.rst +176 -0
  28. data/exe/raven +32 -0
  29. data/lib/raven.rb +3 -0
  30. data/lib/raven/backtrace.rb +137 -0
  31. data/lib/raven/base.rb +106 -0
  32. data/lib/raven/breadcrumbs.rb +76 -0
  33. data/lib/raven/breadcrumbs/activesupport.rb +19 -0
  34. data/lib/raven/breadcrumbs/logger.rb +93 -0
  35. data/lib/raven/cli.rb +59 -0
  36. data/lib/raven/client.rb +142 -0
  37. data/lib/raven/configuration.rb +434 -0
  38. data/lib/raven/context.rb +43 -0
  39. data/lib/raven/event.rb +259 -0
  40. data/lib/raven/instance.rb +221 -0
  41. data/lib/raven/integrations/delayed_job.rb +58 -0
  42. data/lib/raven/integrations/rack-timeout.rb +19 -0
  43. data/lib/raven/integrations/rack.rb +139 -0
  44. data/lib/raven/integrations/rails.rb +79 -0
  45. data/lib/raven/integrations/rails/active_job.rb +59 -0
  46. data/lib/raven/integrations/rails/controller_methods.rb +13 -0
  47. data/lib/raven/integrations/rails/controller_transaction.rb +13 -0
  48. data/lib/raven/integrations/rails/overrides/debug_exceptions_catcher.rb +31 -0
  49. data/lib/raven/integrations/rails/overrides/streaming_reporter.rb +23 -0
  50. data/lib/raven/integrations/railties.rb +1 -0
  51. data/lib/raven/integrations/rake.rb +18 -0
  52. data/lib/raven/integrations/sidekiq.rb +87 -0
  53. data/lib/raven/integrations/tasks.rb +11 -0
  54. data/lib/raven/interface.rb +25 -0
  55. data/lib/raven/interfaces/exception.rb +15 -0
  56. data/lib/raven/interfaces/http.rb +16 -0
  57. data/lib/raven/interfaces/message.rb +20 -0
  58. data/lib/raven/interfaces/single_exception.rb +14 -0
  59. data/lib/raven/interfaces/stack_trace.rb +69 -0
  60. data/lib/raven/linecache.rb +41 -0
  61. data/lib/raven/logger.rb +19 -0
  62. data/lib/raven/processor.rb +15 -0
  63. data/lib/raven/processor/cookies.rb +26 -0
  64. data/lib/raven/processor/http_headers.rb +55 -0
  65. data/lib/raven/processor/post_data.rb +22 -0
  66. data/lib/raven/processor/removecircularreferences.rb +17 -0
  67. data/lib/raven/processor/removestacktrace.rb +24 -0
  68. data/lib/raven/processor/sanitizedata.rb +88 -0
  69. data/lib/raven/processor/utf8conversion.rb +52 -0
  70. data/lib/raven/transports.rb +15 -0
  71. data/lib/raven/transports/dummy.rb +16 -0
  72. data/lib/raven/transports/http.rb +68 -0
  73. data/lib/raven/utils/deep_merge.rb +22 -0
  74. data/lib/raven/utils/real_ip.rb +62 -0
  75. data/lib/raven/version.rb +5 -0
  76. data/lib/sentry-raven-without-integrations.rb +1 -0
  77. data/lib/sentry-raven.rb +1 -0
  78. data/pkg/sentry-raven-2.7.2.gem +0 -0
  79. metadata +143 -0
@@ -0,0 +1,155 @@
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
@@ -0,0 +1,124 @@
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``.
@@ -0,0 +1,31 @@
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
+ }
@@ -0,0 +1,176 @@
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.