Skip to content

Commit

Permalink
Don't start Sentry::SendEventJob's transaction (#1547)
Browse files Browse the repository at this point in the history
* Don't start Sentry::SendEventJob's transaction

* Update changelog
  • Loading branch information
st0012 authored Aug 22, 2021
1 parent 3ddb146 commit 2cc4c21
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
- Fixes [#1541](https://github.com/getsentry/sentry-ruby/issues/1541)
- Don't apply Scope's transaction name if it's empty [#1546](https://github.com/getsentry/sentry-ruby/pull/1546)
- Fixes [#1540](https://github.com/getsentry/sentry-ruby/issues/1540)
- Don't start `Sentry::SendEventJob`'s transaction [#1547](https://github.com/getsentry/sentry-ruby/pull/1547)
- Fixes [#1539](https://github.com/getsentry/sentry-ruby/issues/1539)

## 4.6.5

Expand Down
5 changes: 0 additions & 5 deletions sentry-rails/app/jobs/sentry/send_event_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ class SendEventJob < parent_job
end

def perform(event, hint = {})
# users don't need the tracing result of this job
if transaction = Sentry.get_current_scope.span
transaction.instance_variable_set(:@sampled, false)
end

Sentry.send_event(event, hint)
end
end
Expand Down
7 changes: 6 additions & 1 deletion sentry-rails/lib/sentry/rails/active_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ def self.included(base)

def capture_and_reraise_with_sentry(job, scope, block)
scope.set_transaction_name(job.class.name)
transaction = Sentry.start_transaction(name: scope.transaction_name, op: "active_job")
transaction =
if job.is_a?(::Sentry::SendEventJob)
nil
else
Sentry.start_transaction(name: scope.transaction_name, op: "active_job")
end

scope.set_span(transaction) if transaction

Expand Down

0 comments on commit 2cc4c21

Please sign in to comment.