Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions .github/workflows/prepare_raven_release.yml

This file was deleted.

69 changes: 0 additions & 69 deletions .github/workflows/sentry_raven_test.yml

This file was deleted.

1 change: 0 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Style/RedundantFreeze:

AllCops:
Exclude:
- "sentry-raven/**/*"
- "sentry-*/tmp/**/*"
- "sentry-*/examples/**/*"
- "sentry-*/spec/versioned/2.7/**/*"
20 changes: 0 additions & 20 deletions .scripts/bump-version.rb

This file was deleted.

13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## Unreleased (6.0.0)

### Breaking Changes

- Remove `config.async` [#1894](https://github.com/getsentry/sentry-ruby/pull/1894)
- Migrate from to_hash to to_h ([#2351](https://github.com/getsentry/sentry-ruby/pull/2351))
- Add `before_send_check_in` for applying to `CheckInEvent` ([#2703](https://github.com/getsentry/sentry-ruby/pull/2703))
- Returning a hash from `before_send` and `before_send_transaction` is no longer supported and will drop the event.

### Internal

- Archive [`sentry-raven`](https://github.com/getsentry/raven-ruby) ([#2708](https://github.com/getsentry/sentry-ruby/pull/2708))

## Unreleased

### Bug Fixes
Expand Down
16 changes: 8 additions & 8 deletions sentry-delayed_job/spec/sentry/delayed_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def do_nothing_with_args(a)
enqueued_job.invoke_job

expect(transport.events.count).to eq(1)
event = transport.events.last.to_hash
event = transport.events.last.to_h
expect(event[:message]).to eq("report")
expect(event[:contexts][:"Delayed-Job"][:id]).to eq(enqueued_job.id.to_s)
expect(event[:tags]).to eq({ "delayed_job.id" => enqueued_job.id.to_s, "delayed_job.queue" => nil })
Expand All @@ -68,7 +68,7 @@ def do_nothing_with_args(a)
enqueued_job.invoke_job

expect(transport.events.count).to eq(1)
event = transport.events.last.to_hash
event = transport.events.last.to_h
expect(event[:message]).to eq("tagged report")
expect(event[:tags]).to eq({ "delayed_job.id" => enqueued_job.id.to_s, "delayed_job.queue" => nil, number: 1 })

Expand All @@ -77,7 +77,7 @@ def do_nothing_with_args(a)
enqueued_job.invoke_job

expect(transport.events.count).to eq(2)
event = transport.events.last.to_hash
event = transport.events.last.to_h
expect(event[:tags]).to eq({ "delayed_job.id" => enqueued_job.id.to_s, "delayed_job.queue" => nil })
end

Expand All @@ -93,7 +93,7 @@ def do_nothing_with_args(a)
end.to raise_error(ZeroDivisionError)

expect(transport.events.count).to eq(1)
event = transport.events.last.to_hash
event = transport.events.last.to_h

expect(event[:sdk]).to eq({ name: "sentry.ruby.delayed_job", version: described_class::VERSION })
expect(event.dig(:exception, :values, 0, :type)).to eq("ZeroDivisionError")
Expand All @@ -109,7 +109,7 @@ def do_nothing_with_args(a)
end.to raise_error(RuntimeError)

expect(transport.events.count).to eq(1)
event = transport.events.last.to_hash
event = transport.events.last.to_h

expect(event[:tags]).to eq({ "delayed_job.id" => enqueued_job.id.to_s, "delayed_job.queue" => nil, number: 1 })
expect(Sentry.get_current_scope.extra).to eq({})
Expand All @@ -123,7 +123,7 @@ def do_nothing_with_args(a)
end.to raise_error(ZeroDivisionError)

expect(transport.events.count).to eq(2)
event = transport.events.last.to_hash
event = transport.events.last.to_h
expect(event[:tags]).to eq({ "delayed_job.id" => enqueued_job.id.to_s, "delayed_job.queue" => nil })
expect(Sentry.get_current_scope.extra).to eq({})
expect(Sentry.get_current_scope.tags).to eq({})
Expand Down Expand Up @@ -228,7 +228,7 @@ def perform
it "injects ActiveJob information to the event" do
expect(transport.events.count).to eq(1)

event = transport.events.last.to_hash
event = transport.events.last.to_h
expect(event[:message]).to eq("report from ActiveJob")
expect(event[:tags]).to match({ "delayed_job.id" => anything, "delayed_job.queue" => "default", number: 1 })
expect(event[:contexts][:"Active-Job"][:job_class]).to eq("ReportingJob")
Expand All @@ -255,7 +255,7 @@ def perform
it "injects ActiveJob information to the event" do
expect(transport.events.count).to eq(1)

event = transport.events.last.to_hash
event = transport.events.last.to_h
expect(event.dig(:exception, :values, 0, :type)).to eq("ZeroDivisionError")
expect(event[:tags]).to match({ "delayed_job.id" => anything, "delayed_job.queue" => "default", number: 2 })
expect(event[:contexts][:"Active-Job"][:job_class]).to eq("FailedJob")
Expand Down
18 changes: 7 additions & 11 deletions sentry-rails/lib/sentry/rails/active_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,13 @@ def record(job, &block)
Sentry.with_scope do |scope|
begin
scope.set_transaction_name(job.class.name, source: :task)
transaction =
if job.is_a?(::Sentry::SendEventJob)
nil
else
Sentry.start_transaction(
name: scope.transaction_name,
source: scope.transaction_source,
op: OP_NAME,
origin: SPAN_ORIGIN
)
end

transaction = Sentry.start_transaction(
name: scope.transaction_name,
source: scope.transaction_source,
op: OP_NAME,
origin: SPAN_ORIGIN
)

scope.set_span(transaction) if transaction

Expand Down
11 changes: 0 additions & 11 deletions sentry-rails/lib/sentry/rails/overrides/streaming_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ def log_error(exception)
super
end
end

module OldStreamingReporter
def self.included(base)
base.send(:alias_method_chain, :log_error, :raven)
end

def log_error_with_raven(exception)
Sentry::Rails.capture_exception(exception)
log_error_without_raven(exception)
end
end
end
end
end
54 changes: 5 additions & 49 deletions sentry-rails/spec/sentry/rails/activejob_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,50 +229,6 @@ def perform
event = transport.events.last.to_json_compatible
expect(event.dig("exception", "values", 0, "type")).to eq("ZeroDivisionError")
end

context "and in user-defined reporting job too" do
before do
Sentry.configuration.async = lambda do |event, hint|
UserDefinedReportingJob.perform_now(event, hint)
end
end

class UserDefinedReportingJob < ActiveJob::Base
def perform(event, hint)
Post.find(0)
rescue
raise ActiveJob::DeserializationError
end
end

it "doesn't cause infinite loop because of excluded exceptions" do
expect do
DeserializationErrorJob.perform_now
end.to raise_error(ActiveJob::DeserializationError, /divided by 0/)
end
end

context "and in customized SentryJob too" do
before do
class CustomSentryJob < ::Sentry::SendEventJob
def perform(event, hint)
raise "Not excluded exception"
rescue
raise ActiveJob::DeserializationError
end
end

Sentry.configuration.async = lambda do |event, hint|
CustomSentryJob.perform_now(event, hint)
end
end

it "doesn't cause infinite loop" do
expect do
DeserializationErrorJob.perform_now
end.to raise_error(ActiveJob::DeserializationError, /divided by 0/)
end
end
end

context 'using rescue_from' do
Expand All @@ -293,7 +249,7 @@ def perform(event, hint)
expect(transport.events.size).to eq(1)

event = transport.events.first
exceptions_data = event.exception.to_hash[:values]
exceptions_data = event.exception.to_h[:values]

expect(exceptions_data.count).to eq(2)
expect(exceptions_data[0][:type]).to eq("FailedJob::TestError")
Expand Down Expand Up @@ -331,7 +287,7 @@ def perform(event, hint)
first = transport.events[0]
check_in_id = first.check_in_id
expect(first).to be_a(Sentry::CheckInEvent)
expect(first.to_hash).to include(
expect(first.to_h).to include(
type: 'check_in',
check_in_id: check_in_id,
monitor_slug: "normaljobwithcron",
Expand All @@ -340,7 +296,7 @@ def perform(event, hint)

second = transport.events[1]
expect(second).to be_a(Sentry::CheckInEvent)
expect(second.to_hash).to include(
expect(second.to_h).to include(
:duration,
type: 'check_in',
check_in_id: check_in_id,
Expand All @@ -359,7 +315,7 @@ def perform(event, hint)
first = transport.events[0]
check_in_id = first.check_in_id
expect(first).to be_a(Sentry::CheckInEvent)
expect(first.to_hash).to include(
expect(first.to_h).to include(
type: 'check_in',
check_in_id: check_in_id,
monitor_slug: "failed_job",
Expand All @@ -369,7 +325,7 @@ def perform(event, hint)

second = transport.events[1]
expect(second).to be_a(Sentry::CheckInEvent)
expect(second.to_hash).to include(
expect(second.to_h).to include(
:duration,
type: 'check_in',
check_in_id: check_in_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@

expect(transport.events.count).to eq(1)

transaction = transport.events.last.to_hash
transaction = transport.events.last.to_h
breadcrumbs = transaction[:breadcrumbs][:values]
process_action_crumb = breadcrumbs.last
expect(process_action_crumb[:category]).to eq("process_action.action_controller")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@

expect(transport.events.count).to eq(1)

transaction = transport.events.last.to_hash
transaction = transport.events.last.to_h
breadcrumbs = transaction[:breadcrumbs][:values]
process_action_crumb = breadcrumbs.last
expect(process_action_crumb[:category]).to eq("process_action.action_controller")
Expand Down
6 changes: 3 additions & 3 deletions sentry-rails/spec/sentry/rails/controller_methods_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def request
event = transport.events.last
expect(event.message).to eq("foo")
expect(event.tags).to eq({ new_tag: true })
expect(event.to_hash.dig(:request, :url)).to eq("http://example.org/test")
expect(event.to_h.dig(:request, :url)).to eq("http://example.org/test")
end
end

Expand All @@ -49,8 +49,8 @@ def request

event = transport.events.last
expect(event.tags).to eq({ new_tag: true })
expect(event.to_hash.dig(:exception, :values, 0, :type)).to eq("ZeroDivisionError")
expect(event.to_hash.dig(:request, :url)).to eq("http://example.org/test")
expect(event.to_h.dig(:exception, :values, 0, :type)).to eq("ZeroDivisionError")
expect(event.to_h.dig(:request, :url)).to eq("http://example.org/test")
end
end
end
Loading
Loading