Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrorHandler should cleanup the scope #2059

Merged
merged 2 commits into from
Jun 26, 2023
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Fixes [#2054](https://github.com/getsentry/sentry-ruby/issues/2054)
- Ignore low-level Puma exceptions by default [#2055](https://github.com/getsentry/sentry-ruby/pull/2055)
- Use allowlist to filter `ActiveSupport` breadcrumbs' data [#2048](https://github.com/getsentry/sentry-ruby/pull/2048)
- ErrorHandler should cleanup the scope ([#2059](https://github.com/getsentry/sentry-ruby/pull/2059))


## 5.9.0
Expand Down
2 changes: 2 additions & 0 deletions sentry-sidekiq/lib/sentry/sidekiq/error_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def call(ex, context)
contexts: { sidekiq: context_filter.filtered },
hint: { background: false }
)
ensure
scope&.clear
end

private
Expand Down
2 changes: 2 additions & 0 deletions sentry-sidekiq/spec/sentry/sidekiq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
expect(event["tags"]).to eq("queue" => "default", "jid" => "123123", "mood" => "sad")
expect(event["transaction"]).to eq("Sidekiq/SadWorker")
expect(event["breadcrumbs"]["values"][0]["message"]).to eq("I'm sad!")
expect(Sentry.get_current_scope.tags).to be_empty
end

it "cleans up context from failed jobs" do
Expand All @@ -86,6 +87,7 @@

expect(event["tags"]).to eq("queue" => "default", "jid" => "123123", "mood" => "very sad")
expect(event["breadcrumbs"]["values"][0]["message"]).to eq("I'm very sad!")
expect(Sentry.get_current_scope.tags).to be_empty
end
end

Expand Down