sentry-raven 3.1.1 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.craft.yml +9 -5
- data/.scripts/bump-version.rb +5 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile +5 -1
- data/Makefile +3 -0
- data/README.md +19 -7
- data/lib/raven/base.rb +1 -0
- data/lib/raven/configuration.rb +0 -1
- data/lib/raven/event.rb +5 -1
- data/lib/raven/instance.rb +7 -1
- data/lib/raven/integrations/delayed_job.rb +1 -1
- data/lib/raven/integrations/rack.rb +2 -14
- data/lib/raven/transports/http.rb +2 -1
- data/lib/raven/utils/request_id.rb +16 -0
- data/lib/raven/version.rb +1 -1
- data/sentry-raven.gemspec +7 -0
- metadata +10 -148
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -32
- data/.github/pull_request_template.md +0 -16
- data/.github/workflows/test.yml +0 -92
- data/.github/workflows/zeus_upload.yml +0 -32
- data/.gitignore +0 -16
- data/.gitmodules +0 -0
- data/.rspec +0 -1
- data/.rubocop.yml +0 -112
- data/.scripts/bump-version.sh +0 -9
- data/CONTRIBUTING.md +0 -71
- data/sentry-ruby/.gitignore +0 -11
- data/sentry-ruby/.rspec +0 -3
- data/sentry-ruby/.travis.yml +0 -6
- data/sentry-ruby/CODE_OF_CONDUCT.md +0 -74
- data/sentry-ruby/Gemfile +0 -9
- data/sentry-ruby/LICENSE.txt +0 -21
- data/sentry-ruby/README.md +0 -44
- data/sentry-ruby/Rakefile +0 -6
- data/sentry-ruby/bin/console +0 -14
- data/sentry-ruby/bin/setup +0 -8
- data/sentry-ruby/examples/rails-6.0/.browserslistrc +0 -1
- data/sentry-ruby/examples/rails-6.0/.gitignore +0 -35
- data/sentry-ruby/examples/rails-6.0/Gemfile +0 -58
- data/sentry-ruby/examples/rails-6.0/README.md +0 -23
- data/sentry-ruby/examples/rails-6.0/Rakefile +0 -6
- data/sentry-ruby/examples/rails-6.0/app/assets/config/manifest.js +0 -2
- data/sentry-ruby/examples/rails-6.0/app/assets/images/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/app/assets/stylesheets/application.css +0 -15
- data/sentry-ruby/examples/rails-6.0/app/channels/application_cable/channel.rb +0 -4
- data/sentry-ruby/examples/rails-6.0/app/channels/application_cable/connection.rb +0 -4
- data/sentry-ruby/examples/rails-6.0/app/controllers/application_controller.rb +0 -2
- data/sentry-ruby/examples/rails-6.0/app/controllers/concerns/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/app/controllers/welcome_controller.rb +0 -23
- data/sentry-ruby/examples/rails-6.0/app/helpers/application_helper.rb +0 -2
- data/sentry-ruby/examples/rails-6.0/app/javascript/channels/consumer.js +0 -6
- data/sentry-ruby/examples/rails-6.0/app/javascript/channels/index.js +0 -5
- data/sentry-ruby/examples/rails-6.0/app/javascript/packs/application.js +0 -17
- data/sentry-ruby/examples/rails-6.0/app/jobs/application_job.rb +0 -7
- data/sentry-ruby/examples/rails-6.0/app/mailers/application_mailer.rb +0 -4
- data/sentry-ruby/examples/rails-6.0/app/models/application_record.rb +0 -3
- data/sentry-ruby/examples/rails-6.0/app/models/concerns/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/app/views/layouts/application.html.erb +0 -15
- data/sentry-ruby/examples/rails-6.0/app/views/layouts/mailer.html.erb +0 -13
- data/sentry-ruby/examples/rails-6.0/app/views/layouts/mailer.text.erb +0 -1
- data/sentry-ruby/examples/rails-6.0/app/views/welcome/report_demo.html.erb +0 -22
- data/sentry-ruby/examples/rails-6.0/app/views/welcome/view_error.html.erb +0 -1
- data/sentry-ruby/examples/rails-6.0/app/workers/error_worker.rb +0 -7
- data/sentry-ruby/examples/rails-6.0/babel.config.js +0 -72
- data/sentry-ruby/examples/rails-6.0/bin/bundle +0 -114
- data/sentry-ruby/examples/rails-6.0/bin/rails +0 -9
- data/sentry-ruby/examples/rails-6.0/bin/rake +0 -9
- data/sentry-ruby/examples/rails-6.0/bin/setup +0 -36
- data/sentry-ruby/examples/rails-6.0/bin/spring +0 -17
- data/sentry-ruby/examples/rails-6.0/bin/webpack +0 -18
- data/sentry-ruby/examples/rails-6.0/bin/webpack-dev-server +0 -18
- data/sentry-ruby/examples/rails-6.0/bin/yarn +0 -11
- data/sentry-ruby/examples/rails-6.0/config.ru +0 -5
- data/sentry-ruby/examples/rails-6.0/config/application.rb +0 -28
- data/sentry-ruby/examples/rails-6.0/config/boot.rb +0 -4
- data/sentry-ruby/examples/rails-6.0/config/cable.yml +0 -10
- data/sentry-ruby/examples/rails-6.0/config/credentials.yml.enc +0 -1
- data/sentry-ruby/examples/rails-6.0/config/database.yml +0 -25
- data/sentry-ruby/examples/rails-6.0/config/environment.rb +0 -5
- data/sentry-ruby/examples/rails-6.0/config/environments/development.rb +0 -62
- data/sentry-ruby/examples/rails-6.0/config/environments/production.rb +0 -112
- data/sentry-ruby/examples/rails-6.0/config/environments/test.rb +0 -48
- data/sentry-ruby/examples/rails-6.0/config/initializers/application_controller_renderer.rb +0 -8
- data/sentry-ruby/examples/rails-6.0/config/initializers/assets.rb +0 -14
- data/sentry-ruby/examples/rails-6.0/config/initializers/backtrace_silencers.rb +0 -7
- data/sentry-ruby/examples/rails-6.0/config/initializers/content_security_policy.rb +0 -30
- data/sentry-ruby/examples/rails-6.0/config/initializers/cookies_serializer.rb +0 -5
- data/sentry-ruby/examples/rails-6.0/config/initializers/filter_parameter_logging.rb +0 -4
- data/sentry-ruby/examples/rails-6.0/config/initializers/inflections.rb +0 -16
- data/sentry-ruby/examples/rails-6.0/config/initializers/mime_types.rb +0 -4
- data/sentry-ruby/examples/rails-6.0/config/initializers/wrap_parameters.rb +0 -14
- data/sentry-ruby/examples/rails-6.0/config/locales/en.yml +0 -33
- data/sentry-ruby/examples/rails-6.0/config/puma.rb +0 -38
- data/sentry-ruby/examples/rails-6.0/config/routes.rb +0 -10
- data/sentry-ruby/examples/rails-6.0/config/spring.rb +0 -6
- data/sentry-ruby/examples/rails-6.0/config/storage.yml +0 -34
- data/sentry-ruby/examples/rails-6.0/config/webpack/development.js +0 -5
- data/sentry-ruby/examples/rails-6.0/config/webpack/environment.js +0 -3
- data/sentry-ruby/examples/rails-6.0/config/webpack/production.js +0 -5
- data/sentry-ruby/examples/rails-6.0/config/webpack/test.js +0 -5
- data/sentry-ruby/examples/rails-6.0/config/webpacker.yml +0 -96
- data/sentry-ruby/examples/rails-6.0/db/seeds.rb +0 -7
- data/sentry-ruby/examples/rails-6.0/lib/assets/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/lib/tasks/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/package.json +0 -15
- data/sentry-ruby/examples/rails-6.0/postcss.config.js +0 -12
- data/sentry-ruby/examples/rails-6.0/public/404.html +0 -67
- data/sentry-ruby/examples/rails-6.0/public/422.html +0 -67
- data/sentry-ruby/examples/rails-6.0/public/500.html +0 -66
- data/sentry-ruby/examples/rails-6.0/public/apple-touch-icon-precomposed.png +0 -0
- data/sentry-ruby/examples/rails-6.0/public/apple-touch-icon.png +0 -0
- data/sentry-ruby/examples/rails-6.0/public/favicon.ico +0 -0
- data/sentry-ruby/examples/rails-6.0/public/robots.txt +0 -1
- data/sentry-ruby/examples/rails-6.0/storage/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/application_system_test_case.rb +0 -5
- data/sentry-ruby/examples/rails-6.0/test/channels/application_cable/connection_test.rb +0 -11
- data/sentry-ruby/examples/rails-6.0/test/controllers/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/fixtures/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/fixtures/files/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/helpers/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/integration/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/mailers/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/models/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/system/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/test/test_helper.rb +0 -13
- data/sentry-ruby/examples/rails-6.0/vendor/.keep +0 -0
- data/sentry-ruby/examples/rails-6.0/yarn.lock +0 -7508
- data/sentry-ruby/lib/sentry.rb +0 -16
- data/sentry-ruby/lib/sentry/backtrace.rb +0 -128
- data/sentry-ruby/lib/sentry/client.rb +0 -162
- data/sentry-ruby/lib/sentry/client/state.rb +0 -40
- data/sentry-ruby/lib/sentry/configuration.rb +0 -533
- data/sentry-ruby/lib/sentry/event.rb +0 -209
- data/sentry-ruby/lib/sentry/interface.rb +0 -31
- data/sentry-ruby/lib/sentry/interfaces/exception.rb +0 -15
- data/sentry-ruby/lib/sentry/interfaces/http.rb +0 -16
- data/sentry-ruby/lib/sentry/interfaces/message.rb +0 -18
- data/sentry-ruby/lib/sentry/interfaces/single_exception.rb +0 -14
- data/sentry-ruby/lib/sentry/interfaces/stack_trace.rb +0 -69
- data/sentry-ruby/lib/sentry/linecache.rb +0 -44
- data/sentry-ruby/lib/sentry/logger.rb +0 -20
- data/sentry-ruby/lib/sentry/transports.rb +0 -19
- data/sentry-ruby/lib/sentry/transports/dummy.rb +0 -16
- data/sentry-ruby/lib/sentry/transports/http.rb +0 -66
- data/sentry-ruby/lib/sentry/transports/stdout.rb +0 -20
- data/sentry-ruby/lib/sentry/utils/deep_merge.rb +0 -22
- data/sentry-ruby/lib/sentry/utils/exception_cause_chain.rb +0 -20
- data/sentry-ruby/lib/sentry/version.rb +0 -3
- data/sentry-ruby/sentry-ruby.gemspec +0 -26
- data/sentry-ruby/spec/sentry/backtrace_spec.rb +0 -38
- data/sentry-ruby/spec/sentry/client_spec.rb +0 -443
- data/sentry-ruby/spec/sentry/configuration_spec.rb +0 -400
- data/sentry-ruby/spec/sentry/event_spec.rb +0 -238
- data/sentry-ruby/spec/sentry/interface_spec.rb +0 -38
- data/sentry-ruby/spec/sentry/interfaces/stack_trace_spec.rb +0 -11
- data/sentry-ruby/spec/sentry/linecache_spec.rb +0 -40
- data/sentry-ruby/spec/sentry/transports/http_spec.rb +0 -57
- data/sentry-ruby/spec/sentry/transports/stdout_spec.rb +0 -11
- data/sentry-ruby/spec/sentry_spec.rb +0 -9
- data/sentry-ruby/spec/spec_helper.rb +0 -49
- data/sentry-ruby/spec/support/linecache.txt +0 -6
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'sentry/interface'
|
3
|
-
|
4
|
-
class TestInterface < Sentry::Interface
|
5
|
-
attr_accessor :some_attr
|
6
|
-
end
|
7
|
-
|
8
|
-
RSpec.describe Sentry::Interface do
|
9
|
-
it "should register an interface when a new class is defined" do
|
10
|
-
expect(Sentry::Interface.registered[:test]).to eq(TestInterface)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "can be initialized with some attributes" do
|
14
|
-
interface = TestInterface.new(:some_attr => "test")
|
15
|
-
expect(interface.some_attr).to eq("test")
|
16
|
-
end
|
17
|
-
|
18
|
-
it "can initialize with a block" do
|
19
|
-
interface = TestInterface.new { |int| int.some_attr = "test" }
|
20
|
-
expect(interface.some_attr).to eq("test")
|
21
|
-
end
|
22
|
-
|
23
|
-
it "serializes to a Hash" do
|
24
|
-
interface = TestInterface.new(:some_attr => "test")
|
25
|
-
expect(interface.to_hash).to eq(:some_attr => "test")
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
RSpec.describe Sentry::MessageInterface do
|
30
|
-
it "supports invalid format string message when params is not defined" do
|
31
|
-
interface = Sentry::MessageInterface.new(:params => nil, :message => "test '%'")
|
32
|
-
expect(interface.unformatted_message).to eq("test '%'")
|
33
|
-
end
|
34
|
-
it "supports invalid format string message when params is empty" do
|
35
|
-
interface = Sentry::MessageInterface.new(:message => "test '%'")
|
36
|
-
expect(interface.unformatted_message).to eq("test '%'")
|
37
|
-
end
|
38
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Sentry::StacktraceInterface::Frame do
|
4
|
-
it "should convert pathnames to strings" do
|
5
|
-
frame = Sentry::StacktraceInterface::Frame.new(configuration: Sentry::Configuration.new)
|
6
|
-
$LOAD_PATH.unshift Pathname.pwd # Oh no, a Pathname in the $LOAD_PATH!
|
7
|
-
frame.abs_path = __FILE__
|
8
|
-
expect(frame.filename).to match(/stack_trace_spec.rb/)
|
9
|
-
$LOAD_PATH.shift
|
10
|
-
end
|
11
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
# rubocop:disable Style/WordArray
|
3
|
-
RSpec.describe Sentry::LineCache do
|
4
|
-
describe "#get_file_context" do
|
5
|
-
it "returns an array of nils if the path is not valid" do
|
6
|
-
expect(subject.get_file_context("/nonexist", 1, 10)).to eq([nil, nil, nil])
|
7
|
-
end
|
8
|
-
|
9
|
-
it "returns a variable size depending on context" do
|
10
|
-
expect(subject.get_file_context("spec/support/linecache.txt", 3, 2)).to eq(
|
11
|
-
[
|
12
|
-
["foo\n", "bar\n"],
|
13
|
-
"baz\n",
|
14
|
-
["qux\n", "lorem\n"]
|
15
|
-
]
|
16
|
-
)
|
17
|
-
end
|
18
|
-
|
19
|
-
it "returns nil if line doesnt exist" do
|
20
|
-
expect(subject.get_file_context("spec/support/linecache.txt", 1, 2)).to eq(
|
21
|
-
[
|
22
|
-
[nil, nil],
|
23
|
-
"foo\n",
|
24
|
-
["bar\n", "baz\n"]
|
25
|
-
]
|
26
|
-
)
|
27
|
-
end
|
28
|
-
|
29
|
-
it "returns a different section of the file based on lineno" do
|
30
|
-
expect(subject.get_file_context("./spec/support/linecache.txt", 4, 2)).to eq(
|
31
|
-
[
|
32
|
-
["bar\n", "baz\n"],
|
33
|
-
"qux\n",
|
34
|
-
["lorem\n", "ipsum\n"]
|
35
|
-
]
|
36
|
-
)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
# rubocop:enable Style/WordArray
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Sentry::Transports::HTTP do
|
4
|
-
let(:config) { Sentry::Configuration.new.tap { |c| c.dsn = 'http://12345@sentry.localdomain/sentry/42' } }
|
5
|
-
let(:client) { Sentry::Client.new(config) }
|
6
|
-
|
7
|
-
it 'should set a custom User-Agent' do
|
8
|
-
expect(client.send(:transport).conn.headers[:user_agent]).to eq("sentry-ruby/#{Sentry::VERSION}")
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should raise an error on 4xx responses' do
|
12
|
-
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
13
|
-
stub.post('sentry/api/42/store/') { [404, {}, 'not found'] }
|
14
|
-
end
|
15
|
-
client.configuration.http_adapter = [:test, stubs]
|
16
|
-
|
17
|
-
event = JSON.generate(Sentry.capture_message("test").to_hash)
|
18
|
-
expect { client.send(:transport).send_event("test", event) }.to raise_error(Sentry::Error, /the server responded with status 404/)
|
19
|
-
|
20
|
-
stubs.verify_stubbed_calls
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should raise an error on 5xx responses' do
|
24
|
-
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
25
|
-
stub.post('sentry/api/42/store/') { [500, {}, 'error'] }
|
26
|
-
end
|
27
|
-
client.configuration.http_adapter = [:test, stubs]
|
28
|
-
|
29
|
-
event = JSON.generate(Sentry.capture_message("test").to_hash)
|
30
|
-
expect { client.send(:transport).send_event("test", event) }.to raise_error(Sentry::Error, /the server responded with status 500/)
|
31
|
-
|
32
|
-
stubs.verify_stubbed_calls
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'should add header info message to the error' do
|
36
|
-
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
37
|
-
stub.post('sentry/api/42/store/') { [400, { 'x-sentry-error' => 'error_in_header' }, 'error'] }
|
38
|
-
end
|
39
|
-
client.configuration.http_adapter = [:test, stubs]
|
40
|
-
|
41
|
-
event = JSON.generate(Sentry.capture_message("test").to_hash)
|
42
|
-
expect { client.send(:transport).send_event("test", event) }.to raise_error(Sentry::Error, /error_in_header/)
|
43
|
-
|
44
|
-
stubs.verify_stubbed_calls
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'allows to customise faraday' do
|
48
|
-
builder = spy('faraday_builder')
|
49
|
-
expect(Faraday).to receive(:new).and_yield(builder)
|
50
|
-
|
51
|
-
client.configuration.faraday_builder = proc { |b| b.request :instrumentation }
|
52
|
-
|
53
|
-
client.send(:transport)
|
54
|
-
|
55
|
-
expect(builder).to have_received(:request).with(:instrumentation)
|
56
|
-
end
|
57
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Sentry::Transports::Stdout do
|
4
|
-
let(:config) { Sentry::Configuration.new.tap { |c| c.dsn = 'stdout://12345:67890@sentry.localdomain/sentry/42' } }
|
5
|
-
let(:client) { Sentry::Client.new(config) }
|
6
|
-
|
7
|
-
it 'should write to stdout' do
|
8
|
-
event = JSON.generate(Sentry.capture_message("this is an STDOUT transport test").to_hash)
|
9
|
-
expect { client.send(:transport).send_event("stdout test", event) }.to output(/\"message\":\"this is an STDOUT transport test\"/).to_stdout
|
10
|
-
end
|
11
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require "bundler/setup"
|
2
|
-
require "pry"
|
3
|
-
require "sentry"
|
4
|
-
|
5
|
-
RSpec.configure do |config|
|
6
|
-
# Enable flags like --only-failures and --next-failure
|
7
|
-
config.example_status_persistence_file_path = ".rspec_status"
|
8
|
-
|
9
|
-
# Disable RSpec exposing methods globally on `Module` and `main`
|
10
|
-
config.disable_monkey_patching!
|
11
|
-
|
12
|
-
config.expect_with :rspec do |c|
|
13
|
-
c.syntax = :expect
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def build_exception_with_cause(cause = "exception a")
|
18
|
-
begin
|
19
|
-
raise cause
|
20
|
-
rescue
|
21
|
-
raise "exception b"
|
22
|
-
end
|
23
|
-
rescue RuntimeError => e
|
24
|
-
e
|
25
|
-
end
|
26
|
-
|
27
|
-
def build_exception_with_two_causes
|
28
|
-
begin
|
29
|
-
begin
|
30
|
-
raise "exception a"
|
31
|
-
rescue
|
32
|
-
raise "exception b"
|
33
|
-
end
|
34
|
-
rescue
|
35
|
-
raise "exception c"
|
36
|
-
end
|
37
|
-
rescue RuntimeError => e
|
38
|
-
e
|
39
|
-
end
|
40
|
-
|
41
|
-
def build_exception_with_recursive_cause
|
42
|
-
backtrace = []
|
43
|
-
|
44
|
-
exception = double("Exception")
|
45
|
-
allow(exception).to receive(:cause).and_return(exception)
|
46
|
-
allow(exception).to receive(:message).and_return("example")
|
47
|
-
allow(exception).to receive(:backtrace).and_return(backtrace)
|
48
|
-
exception
|
49
|
-
end
|