sentry-raven 0.12.0 → 2.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +13 -0
- data/.gitmodules +0 -0
- data/.rspec +1 -0
- data/.rubocop.yml +74 -0
- data/.travis.yml +47 -0
- data/Gemfile +38 -0
- data/LICENSE +1 -1
- data/README.md +99 -17
- data/Rakefile +30 -0
- data/changelog.md +522 -0
- data/exe/raven +32 -0
- data/lib/raven/backtrace.rb +42 -33
- data/lib/raven/base.rb +70 -188
- data/lib/raven/breadcrumbs/activesupport.rb +19 -0
- data/lib/raven/breadcrumbs/logger.rb +93 -0
- data/lib/raven/breadcrumbs.rb +76 -0
- data/lib/raven/cli.rb +38 -42
- data/lib/raven/client.rb +112 -53
- data/lib/raven/configuration.rb +390 -91
- data/lib/raven/context.rb +28 -6
- data/lib/raven/event.rb +180 -164
- data/lib/raven/instance.rb +233 -0
- data/lib/raven/integrations/delayed_job.rb +30 -21
- data/lib/raven/integrations/rack-timeout.rb +19 -0
- data/lib/raven/integrations/rack.rb +139 -0
- data/lib/raven/integrations/rails/active_job.rb +61 -0
- data/lib/raven/{rails → integrations/rails}/controller_methods.rb +1 -1
- data/lib/raven/integrations/rails/controller_transaction.rb +13 -0
- data/lib/raven/integrations/rails/overrides/debug_exceptions_catcher.rb +31 -0
- data/lib/raven/integrations/rails/overrides/streaming_reporter.rb +23 -0
- data/lib/raven/integrations/rails.rb +79 -0
- data/lib/raven/integrations/railties.rb +1 -0
- data/lib/raven/integrations/rake.rb +18 -0
- data/lib/raven/integrations/sidekiq.rb +87 -0
- data/lib/raven/{tasks.rb → integrations/tasks.rb} +2 -3
- data/lib/raven/interface.rb +25 -0
- data/lib/raven/interfaces/exception.rb +5 -12
- data/lib/raven/interfaces/http.rb +4 -41
- data/lib/raven/interfaces/message.rb +10 -7
- data/lib/raven/interfaces/single_exception.rb +14 -0
- data/lib/raven/interfaces/stack_trace.rb +43 -29
- data/lib/raven/linecache.rb +32 -14
- data/lib/raven/logger.rb +13 -16
- data/lib/raven/processor/cookies.rb +26 -0
- data/lib/raven/processor/http_headers.rb +55 -0
- data/lib/raven/processor/post_data.rb +22 -0
- data/lib/raven/processor/removecircularreferences.rb +9 -9
- data/lib/raven/processor/removestacktrace.rb +16 -3
- data/lib/raven/processor/sanitizedata.rb +75 -29
- data/lib/raven/processor/utf8conversion.rb +38 -12
- data/lib/raven/processor.rb +6 -19
- data/lib/raven/transports/dummy.rb +16 -0
- data/lib/raven/transports/http.rb +41 -29
- data/lib/raven/transports/stdout.rb +20 -0
- data/lib/raven/transports.rb +2 -14
- data/lib/raven/utils/deep_merge.rb +22 -0
- data/lib/raven/utils/exception_cause_chain.rb +19 -0
- data/lib/raven/utils/real_ip.rb +62 -0
- data/lib/raven/version.rb +3 -1
- data/lib/sentry-raven-without-integrations.rb +1 -0
- data/sentry-raven.gemspec +21 -0
- metadata +49 -90
- data/bin/raven +0 -42
- data/lib/raven/better_attr_accessor.rb +0 -44
- data/lib/raven/error.rb +0 -4
- data/lib/raven/interfaces.rb +0 -34
- data/lib/raven/okjson.rb +0 -609
- data/lib/raven/rack.rb +0 -75
- data/lib/raven/rails/middleware/debug_exceptions_catcher.rb +0 -16
- data/lib/raven/railtie.rb +0 -38
- data/lib/raven/rake.rb +0 -13
- data/lib/raven/sidekiq.rb +0 -27
- data/lib/raven/transports/udp.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 478a0cd677f1508fc2153381addf6956e189c5f9491ede8f79b6097977dd59b9
|
4
|
+
data.tar.gz: d87fe2f303acf7e1d8b658950a1e591800eaf8a0f8bbdd35637355ac6856f571
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c83298b6f11a500e50f4e530de5421f32d15f7ea72d3a6aea18cd4330f832073a2000a68228b0237313e709b3e4adba570b140837256798ff3987b9eb0bb0fc9
|
7
|
+
data.tar.gz: 80405a6c1d1f99a7b65ed9491bd17c0d4143a5d5f212c6408988c9de329bc2bee2f2c6c1421d6134cc7f3d4c23ed2da06d0ba76509f6ae191f0236e83c53bdf8
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
File without changes
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
AllCops:
|
2
|
+
Include:
|
3
|
+
- 'lib/**/*.rb'
|
4
|
+
- 'spec/**/*.rb'
|
5
|
+
Exclude:
|
6
|
+
- 'examples/**/*'
|
7
|
+
- 'vendor/**/*'
|
8
|
+
|
9
|
+
Metrics/ClassLength:
|
10
|
+
Max: 300
|
11
|
+
CountComments: false
|
12
|
+
|
13
|
+
Metrics/AbcSize:
|
14
|
+
Max: 40
|
15
|
+
|
16
|
+
Metrics/CyclomaticComplexity:
|
17
|
+
Max: 12
|
18
|
+
|
19
|
+
Metrics/PerceivedComplexity:
|
20
|
+
Max: 11
|
21
|
+
|
22
|
+
Metrics/LineLength:
|
23
|
+
Max: 155
|
24
|
+
|
25
|
+
Metrics/MethodLength:
|
26
|
+
Max: 30
|
27
|
+
|
28
|
+
Style/SignalException:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Performance/Casecmp:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/ClassAndModuleChildren:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Style/ParallelAssignment:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
Style/Documentation:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
Style/RescueModifier:
|
44
|
+
Enabled: false
|
45
|
+
|
46
|
+
Style/StringLiterals:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
Style/CaseEquality:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
Style/DoubleNegation:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
Style/FileName:
|
56
|
+
Exclude:
|
57
|
+
- 'lib/sentry-raven-without-integrations.rb'
|
58
|
+
- 'lib/sentry-raven.rb'
|
59
|
+
|
60
|
+
Style/NumericLiterals:
|
61
|
+
Exclude:
|
62
|
+
- 'spec/raven/processors/sanitizedata_processor_spec.rb'
|
63
|
+
|
64
|
+
Style/HashSyntax:
|
65
|
+
EnforcedStyle: hash_rockets
|
66
|
+
|
67
|
+
Lint/RescueException:
|
68
|
+
Exclude:
|
69
|
+
- 'lib/raven/base.rb'
|
70
|
+
- 'lib/raven/instance.rb'
|
71
|
+
- 'lib/raven/integrations/delayed_job.rb'
|
72
|
+
- 'lib/raven/integrations/rack.rb'
|
73
|
+
- 'lib/raven/integrations/sidekiq.rb'
|
74
|
+
- 'spec/raven/event_spec.rb'
|
data/.travis.yml
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
language: ruby
|
2
|
+
dist: trusty
|
3
|
+
group: beta
|
4
|
+
cache: bundler
|
5
|
+
|
6
|
+
services:
|
7
|
+
- redis-server
|
8
|
+
|
9
|
+
branches:
|
10
|
+
only: [master]
|
11
|
+
|
12
|
+
rvm:
|
13
|
+
- 2.2.10
|
14
|
+
- 2.3.8
|
15
|
+
- 2.4.9
|
16
|
+
- 2.5.7
|
17
|
+
- 2.6.5
|
18
|
+
|
19
|
+
env:
|
20
|
+
- RAILS_VERSION=4
|
21
|
+
- RAILS_VERSION=5
|
22
|
+
- RAILS_VERSION=0
|
23
|
+
|
24
|
+
addons:
|
25
|
+
apt:
|
26
|
+
packages:
|
27
|
+
- haveged
|
28
|
+
|
29
|
+
before_install:
|
30
|
+
- service haveged start
|
31
|
+
# Pin bundler version due to https://github.com/rubygems/rubygems/issues/2055
|
32
|
+
- gem install bundler -v 1.16.0
|
33
|
+
|
34
|
+
matrix:
|
35
|
+
include:
|
36
|
+
- rvm: 1.9
|
37
|
+
env: RAILS_VERSION=4
|
38
|
+
- rvm: jruby-1.7.27
|
39
|
+
env: JRUBY_OPTS="--dev" RAILS_VERSION=4
|
40
|
+
- rvm: jruby-9.2.9.0
|
41
|
+
env: JRUBY_OPTS="--dev -J-Djruby.launch.inproc=true -J-Xmx1024M" RAILS_VERSION=4
|
42
|
+
- rvm: jruby-9.2.9.0
|
43
|
+
env: JRUBY_OPTS="--dev -J-Djruby.launch.inproc=true -J-Xmx1024M" RAILS_VERSION=5
|
44
|
+
- rvm: ruby-head
|
45
|
+
env: RAILS_VERSION=0
|
46
|
+
allow_failures:
|
47
|
+
- rvm: ruby-head
|
data/Gemfile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
source "https://rubygems.org/"
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
if ENV["RAILS_VERSION"] && (ENV["RAILS_VERSION"].to_i == 4)
|
6
|
+
gem "rails", "< 5"
|
7
|
+
gem "rspec-rails", "> 3"
|
8
|
+
elsif ENV["RAILS_VERSION"] && (ENV["RAILS_VERSION"].to_i == 0)
|
9
|
+
# no-op. No Rails.
|
10
|
+
else
|
11
|
+
gem "rails", "< 6"
|
12
|
+
gem "rspec-rails", "> 3"
|
13
|
+
end
|
14
|
+
|
15
|
+
if RUBY_VERSION < '2.0'
|
16
|
+
gem "mime-types", "< 3.0.0"
|
17
|
+
gem "nokogiri", "~> 1.6.8"
|
18
|
+
gem "rack", "~> 1.6.8"
|
19
|
+
gem "sidekiq", "< 3.2"
|
20
|
+
gem "rack-timeout", "0.3.0"
|
21
|
+
else
|
22
|
+
gem "rack"
|
23
|
+
gem "sidekiq"
|
24
|
+
gem "rack-timeout"
|
25
|
+
end
|
26
|
+
gem "pry"
|
27
|
+
gem "pry-coolline"
|
28
|
+
gem "benchmark-ips"
|
29
|
+
gem "benchmark-ipsa" if RUBY_VERSION > '2.0'
|
30
|
+
gem "ruby-prof", platform: :mri
|
31
|
+
gem "rake", "> 12"
|
32
|
+
gem "rubocop", "~> 0.41.1" # Last version that supported 1.9, upgrade to 0.50 after we drop 1.9
|
33
|
+
gem "rspec", "> 3"
|
34
|
+
gem "capybara" # rspec system tests
|
35
|
+
gem "puma" # rspec system tests
|
36
|
+
|
37
|
+
gem "timecop"
|
38
|
+
gem "test-unit", platform: :mri if RUBY_VERSION > '2.2'
|
data/LICENSE
CHANGED
@@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
187
187
|
identification within third-party archives.
|
188
188
|
|
189
|
-
Copyright
|
189
|
+
Copyright 2015 Functional Software, Inc
|
190
190
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
192
192
|
you may not use this file except in compliance with the License.
|
data/README.md
CHANGED
@@ -1,35 +1,61 @@
|
|
1
|
-
|
1
|
+
<p align="center">
|
2
|
+
<a href="https://sentry.io" target="_blank" align="center">
|
3
|
+
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280">
|
4
|
+
</a>
|
5
|
+
<br>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
# Raven-Ruby, the Ruby Client for Sentry
|
2
9
|
|
3
10
|
[![Gem Version](https://img.shields.io/gem/v/sentry-raven.svg)](https://rubygems.org/gems/sentry-raven)
|
4
11
|
[![Build Status](https://img.shields.io/travis/getsentry/raven-ruby/master.svg)](https://travis-ci.org/getsentry/raven-ruby)
|
5
|
-
[![
|
12
|
+
[![Gem](https://img.shields.io/gem/dt/sentry-raven.svg)](https://rubygems.org/gems/sentry-raven/)
|
13
|
+
[![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-raven&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-raven&package-manager=bundler&version-scheme=semver)
|
14
|
+
|
15
|
+
|
16
|
+
[Documentation](https://docs.sentry.io/clients/ruby/) | [Bug Tracker](https://github.com/getsentry/raven-ruby/issues) | [Forum](https://forum.sentry.io/) | IRC: irc.freenode.net, #sentry
|
6
17
|
|
7
|
-
|
18
|
+
The official Ruby-language client and integration layer for the [Sentry](https://github.com/getsentry/sentry) error reporting API.
|
8
19
|
|
9
20
|
## Requirements
|
10
21
|
|
11
|
-
We test on Ruby
|
22
|
+
We test on Ruby 1.9, 2.2, 2.3, and 2.4 at the latest patchlevel/teeny version. We also support JRuby 1.7 and 9.0. Our Rails integration works with Rails 4.2+ (including Rails 5).
|
12
23
|
|
13
24
|
## Getting Started
|
25
|
+
|
14
26
|
### Install
|
27
|
+
|
15
28
|
```ruby
|
16
|
-
gem "sentry-raven"
|
29
|
+
gem "sentry-raven"
|
17
30
|
```
|
18
|
-
|
31
|
+
|
32
|
+
### Raven only runs when SENTRY_DSN is set
|
33
|
+
|
34
|
+
Raven will capture and send exceptions to the Sentry server whenever its DSN is set. This makes environment-based configuration easy - if you don't want to send errors in a certain environment, just don't set the DSN in that environment!
|
35
|
+
|
19
36
|
```bash
|
20
37
|
# Set your SENTRY_DSN environment variable.
|
21
|
-
export SENTRY_DSN=http://public
|
38
|
+
export SENTRY_DSN=http://public@example.com/project-id
|
22
39
|
```
|
23
40
|
```ruby
|
24
41
|
# Or you can configure the client in the code (not recommended - keep your DSN secret!)
|
25
42
|
Raven.configure do |config|
|
26
|
-
config.dsn = 'http://public
|
43
|
+
config.dsn = 'http://public@example.com/project-id'
|
27
44
|
end
|
28
45
|
```
|
29
|
-
|
30
|
-
|
46
|
+
|
47
|
+
### Raven doesn't report some kinds of data by default
|
48
|
+
|
49
|
+
**Raven ignores some exceptions by default** - most of these are related to 404s or controller actions not being found. [For a complete list, see the `IGNORE_DEFAULT` constant](https://github.com/getsentry/raven-ruby/blob/master/lib/raven/configuration.rb).
|
50
|
+
|
51
|
+
Raven doesn't report POST data or cookies by default. In addition, it will attempt to remove any obviously sensitive data, such as credit card or Social Security numbers. For more information about how Sentry processes your data, [check out the documentation on the `processors` config setting.](https://docs.getsentry.com/hosted/clients/ruby/config/)
|
52
|
+
|
53
|
+
### Usage
|
54
|
+
|
55
|
+
**If you use Rails, you're already done - no more configuration required!** Check [Integrations](https://docs.getsentry.com/hosted/clients/ruby/integrations/) for more details on other gems Sentry integrates with automatically.
|
31
56
|
|
32
57
|
Otherwise, Raven supports two methods of capturing exceptions:
|
58
|
+
|
33
59
|
```ruby
|
34
60
|
Raven.capture do
|
35
61
|
# capture any exceptions which happen during execution of this block
|
@@ -43,12 +69,68 @@ rescue ZeroDivisionError => exception
|
|
43
69
|
end
|
44
70
|
```
|
45
71
|
|
46
|
-
|
72
|
+
### More configuration
|
73
|
+
|
74
|
+
You're all set - but there's a few more settings you may want to know about too!
|
75
|
+
|
76
|
+
#### async
|
77
|
+
|
78
|
+
When an error or message occurs, the notification is immediately sent to Sentry. Raven can be configured to send asynchronously:
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
config.async = lambda { |event|
|
82
|
+
Thread.new { Raven.send_event(event) }
|
83
|
+
}
|
84
|
+
```
|
85
|
+
|
86
|
+
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. If the async callback raises an exception, Raven will attempt to send synchronously.
|
47
87
|
|
48
|
-
|
88
|
+
Note that the naive example implementation has a major drawback - it can create an infinite number of threads. We recommend creating a background job, using your background job processor, that will send Sentry notifications in the background.
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
config.async = lambda { |event| SentryJob.perform_later(event) }
|
92
|
+
|
93
|
+
class SentryJob < ActiveJob::Base
|
94
|
+
queue_as :default
|
95
|
+
|
96
|
+
def perform(event)
|
97
|
+
Raven.send_event(event)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
```
|
101
|
+
|
102
|
+
#### transport_failure_callback
|
103
|
+
|
104
|
+
If Raven 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.
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
config.transport_failure_callback = lambda { |event|
|
108
|
+
AdminMailer.email_admins("Oh god, it's on fire!", event).deliver_later
|
109
|
+
}
|
110
|
+
```
|
111
|
+
|
112
|
+
#### Context
|
113
|
+
|
114
|
+
Much of the usefulness of Sentry comes from additional context data with the events. Raven makes this very convenient by providing methods to set thread local context data that is then submitted automatically with all events.
|
115
|
+
|
116
|
+
There are three primary methods for providing request context:
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
# bind the logged in user
|
120
|
+
Raven.user_context email: 'foo@example.com'
|
121
|
+
|
122
|
+
# tag the request with something interesting
|
123
|
+
Raven.tags_context interesting: 'yes'
|
124
|
+
|
125
|
+
# provide a bit of additional context
|
126
|
+
Raven.extra_context happiness: 'very'
|
127
|
+
```
|
128
|
+
|
129
|
+
For more information, see [Context](https://docs.sentry.io/clients/ruby/context/).
|
130
|
+
|
131
|
+
## More Information
|
49
132
|
|
50
|
-
* [Documentation](https://
|
51
|
-
* [Bug Tracker](
|
52
|
-
* [
|
53
|
-
|
54
|
-
* [IRC](irc://irc.freenode.net/sentry>) (irc.freenode.net, #sentry)
|
133
|
+
* [Documentation](https://docs.sentry.io/clients/ruby/)
|
134
|
+
* [Bug Tracker](https://github.com/getsentry/raven-ruby/issues)
|
135
|
+
* [Forum](https://forum.sentry.io/)
|
136
|
+
- [Discord](https://discord.gg/ez5KZN7)
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'raven'
|
3
|
+
require 'rubygems/package_task'
|
4
|
+
require 'bundler/gem_tasks'
|
5
|
+
|
6
|
+
gemspec = Gem::Specification.load(Dir['*.gemspec'].first)
|
7
|
+
|
8
|
+
Gem::PackageTask.new(gemspec).define
|
9
|
+
|
10
|
+
begin
|
11
|
+
require 'rubygems'
|
12
|
+
require 'rspec/core/rake_task'
|
13
|
+
|
14
|
+
require 'rubocop/rake_task'
|
15
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
16
|
+
task.patterns = ['lib/**/*.rb','spec/**/*.rb',]
|
17
|
+
task.options << '--display-cop-names'
|
18
|
+
end
|
19
|
+
|
20
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
21
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
22
|
+
end
|
23
|
+
|
24
|
+
rescue LoadError
|
25
|
+
task :spec do
|
26
|
+
abort "Rspec is not available. bundle install to run unit tests"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
task :default => [:rubocop, :spec]
|