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

Fix error reports not being sent on Sidekiq non-retries #1053

Closed

Conversation

Erol
Copy link

@Erol Erol commented Jun 17, 2021

Summary

There was a bug introduced on #761 which prevented errors on being reported from jobs that are running for the first time (not a retry).

Details

Some wrong assumptions were made on the behavior of retries on #761, mainly the following:

  • retry would be set to a falsey value if the job is not a retry attempt. This is wrong.
  • retry_count can potentially be not present in a retry attempt.

Here's a sample of a message hash for a job running first time with retries set:

{"retry"=>3, "queue"=>"test", "class"=>"TestWorker", "args"=>[], "jid"=>"db020cf431b76e59f12b54d3", "created_at"=>1623896659.149288, "enqueued_at"=>1623896659.150045}

While this is the message hash for a job that has been retried first time:

{"retry"=>3, "queue"=>"test", "class"=>"TestWorker", "args"=>[], "jid"=>"db020cf431b76e59f12b54d3", "created_at"=>1623896659.149288, "enqueued_at"=>1623896687.795098, "error_message"=>"undefined local variable or method `meh' for #<TestWorker:0x00007fe79eeb7480>", "error_class"=>"NameError", "failed_at"=>1623896663.811552, "retry_count"=>0}

This commit aims to correct the bug introduced and allow failed jobs to report errors when they are running for the first time.

There was a bug introduced on rollbar#761 which prevented errors on being
reported from jobs that are running for the first time (not a retry).

Some wrong assumptions were made on the behavior of retries on rollbar#761,
mainly the following:

* `retry` would be set to a falsey value if the job is not a retry
attempt. This is wrong.
* `retry_count` would not be present in a retry attempt.

Here's a sample of a message hash for a job running first time with
retries set:

```
{"retry"=>3, "queue"=>"test", "class"=>"TestWorker", "args"=>[],
"jid"=>"db020cf431b76e59f12b54d3", "created_at"=>1623896659.149288,
"enqueued_at"=>1623896659.150045}
```

While this is the message hash for a job that has been retried first
time:

```
{"retry"=>3, "queue"=>"test", "class"=>"TestWorker", "args"=>[],
"jid"=>"db020cf431b76e59f12b54d3", "created_at"=>1623896659.149288,
"enqueued_at"=>1623896687.795098, "error_message"=>"undefined local
variable or method `meh' for #<TestWorker:0x00007fe79eeb7480>",
"error_class"=>"NameError", "failed_at"=>1623896663.811552,
"retry_count"=>0}
```

This commit aims to correct the bug introduced and allow failed jobs to
report errors when they are running for the first time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant