Skip to content

Support extracting timezone out of crontab in sidekiq-scheduler #2187

@shalvah-gs

Description

@shalvah-gs

Issue Description

Hi, just tried out the new auto-crons feature for Sidekiq scheduler. Are there any caveats around it? We have a bunch of running jobs (Rails), but only one shows up in Sentry.

We have a sidekiq_scheduler.yml.erb:

Details
process_webhook_requests:
  every: '15s'
  class: StagedWebhookRequestEnqueuerJob

call_status_refresher:
  every: '2h'
  class: CallStatusRefresherEnqueuerJob

delete_webhook_requests:
  cron: '0 21 * * * Europe/Berlin' # 9pm daily
  class: StagedWebhookRequestDeleterJob

process_scheduled_call_requests:
  cron: '*/1 * * * * Europe/Berlin' # Runs every 1 minute
  class: ScheduledCallRequestsProcessorJob

and we have this in our Sidekiq initializer:

Details
if ENV.fetch('RUN_SIDEKIQ_CRON').to_bool && Sidekiq.server?
  Sidekiq.configure_server do |config|
    config.on(:startup) do
      scheduler_file_content = File.read(Rails.root.join('config/sidekiq_scheduler.yml.erb'))

      Sidekiq.schedule = YAML.safe_load(
        ERB.new(scheduler_file_content).result
      )

      Sidekiq::Scheduler.reload_schedule!
    end
  end
else
  Sidekiq::Scheduler.enabled = false
end

However, only one job shows up in the UI, after 18+ hours of running:

image

I've checked the logs, and we have the "Injected Sentry Crons monitor checkins into ..." message for all four jobs. And I can also see the transport messages:

image

which makes me wonder if this is a backend issue?

Reproduction Steps

Add config.enabled_patches += [:sidekiq_scheduler]

We did not make any other changes to our individual jobs.

Expected Behavior

Expected to see all check-ins in the UI

Actual Behavior

Only saw the one with a schedule every: 2h.

Ruby Version

3.2

SDK Version

5.14.0

Integration and Its Version

Rails, Sidekiq, all version 5.14.0

Sentry Config

Sentry.init do |config|
  config.enabled_environments = %w[production]
  filterable_params = Rails.application.config.filter_parameters
  filter = ActiveSupport::ParameterFilter.new(filterable_params)
  config.before_send = lambda do |event, _hint|
    filter.filter(event.to_hash)
  end
  config.breadcrumbs_logger = [:active_support_logger]
  config.excluded_exceptions -= ['ActiveRecord::RecordNotFound']
  config.excluded_exceptions += ['Errors::ExpectedError']
  config.enabled_patches += [:sidekiq_scheduler]
end

Metadata

Metadata

Assignees

Labels

No labels
No labels
No fields configured for issues without a type.

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions