Skip to content

report_after_job_retries option is ignored if sidekiq workers's retry is not specified #1698

@viralpraxis

Description

@viralpraxis

Environment

Sentry SaaS (sentry.io)
Sentry-sidekiq 5.0
Sidekiq 6.4.0

Steps to Reproduce

  1. Setup Sentry with sidekiq.report_after_job_retries set to true
  2. Create a Sidekiq worker which does not specify the per-worker retry option

Expected Result

According to Sidekiq documentation, if the retry is not specified, jobs will be retried 25 times. So if a job fails 25 times we expect sentry to report only the last one.

Actual Result

Senty reports every failed retry, ignoring the sidekiq.report_after_job_retries option.
However, setting retry option explicitly solves the issue.
Sidekiq's default retry value is true (boolean), while this code expects integer (sentry-sidekiq/lib/sentry/sidekiq/error_handler.rb)

if Sentry.configuration.sidekiq.report_after_job_retries && retry_option.is_a?(Integer) && retry_option.positive?
  retry_count = context.dig(:job, "retry_count")
  if retry_count.nil? || retry_count < retry_option - 1
    return
  end
end

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions