Skip to content

Sentry::Cron::MonitorCheckIns breaks ActiveJob keyword arguments #2198

@jamesbebbington

Description

@jamesbebbington

Issue Description

It appears that Sentry::Cron::MonitorCheckIns::Patch#perform is not forwarding keyword arguments.

Reproduction Steps

include Sentry::Cron::MonitorCheckIns in an ActiveJob, and attempt to use keyword arguments.

Expected Behavior

Given a job that doesn't include Sentry::Cron::MonitorCheckIns:

class CronJob < ApplicationJob

  def work(a, b, c)
    puts "a: #{a}, b: #{b}, c: #{c}"
  end

  def perform(a, b = 42, c: 99)
    work(a, b, c)
  end

end

it behaves as expected:

3.2.2 :001 > CronJob.perform_now(2, 43)
a: 2, b: 43, c: 99
3.2.2 :002 > CronJob.perform_now(2, 43, c: 100)
a: 2, b: 43, c: 100

Actual Behavior

Given a job that includes Sentry::Cron::MonitorCheckIns:

class CronJob < ApplicationJob

  include Sentry::Cron::MonitorCheckIns

  sentry_monitor_check_ins

  def work(a, b, c)
    puts "a: #{a}, b: #{b}, c: #{c}"
  end

  def perform(a, b = 42, c: 99)
    work(a, b, c)
  end

end

Passing a keyword argument raises an ArgumentError:

3.2.2 :001 > CronJob.perform_now(2, 43)
a: 2, b: 43, c: 99
3.2.2 :002 > CronJob.perform_now(2, 43, c: 100)
ArgumentError (wrong number of arguments (given 3, expected 1..2))

Ruby Version

3.2.2

SDK Version

5.15.0

Integration and Its Version

Rails 7.1.2, GoodJob 3.21.5

Sentry Config

No response

Metadata

Metadata

Assignees

Labels

No fields configured for issues without a type.

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions