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

Crons automatic support for gems #2134

Closed
sl0thentr0py opened this issue Oct 10, 2023 · 10 comments
Closed

Crons automatic support for gems #2134

sl0thentr0py opened this issue Oct 10, 2023 · 10 comments
Assignees

Comments

@sl0thentr0py
Copy link
Member

sl0thentr0py commented Oct 10, 2023

  • sidekiq-cron
  • sidekiq-scheduler
  • whenever bash based, so just use sentry-cli
  • clockwork also unaware of job system, so we can't really patch

Originally posted by @sl0thentr0py in #2090 (comment)

@sl0thentr0py sl0thentr0py self-assigned this Oct 10, 2023
sl0thentr0py added a commit that referenced this issue Nov 15, 2023
schedule

* optional patch under `sidekiq_cron`
* patch the `Sidekiq::Cron::Job#save` method and auto inject the
  Sentry::MonitorCheckIns module and turn monitoring on

part of #2134
sl0thentr0py added a commit that referenced this issue Nov 16, 2023
schedule

* optional patch under `sidekiq_cron`
* patch the `Sidekiq::Cron::Job#save` method and auto inject the
  Sentry::MonitorCheckIns module and turn monitoring on

part of #2134
sl0thentr0py added a commit that referenced this issue Nov 16, 2023
schedule

* optional patch under `sidekiq_cron`
* patch the `Sidekiq::Cron::Job#save` method and auto inject the
  Sentry::MonitorCheckIns module and turn monitoring on

part of #2134
sl0thentr0py added a commit that referenced this issue Nov 16, 2023
schedule

* optional patch under `sidekiq_cron`
* patch the `Sidekiq::Cron::Job#save` method and auto inject the
  Sentry::MonitorCheckIns module and turn monitoring on

part of #2134
sl0thentr0py added a commit that referenced this issue Nov 16, 2023
schedule

* optional patch under `sidekiq_cron`
* patch the `Sidekiq::Cron::Job#save` method and auto inject the
  Sentry::MonitorCheckIns module and turn monitoring on

part of #2134
sl0thentr0py added a commit that referenced this issue Nov 16, 2023
schedule

* optional patch under `sidekiq_cron`
* patch the `Sidekiq::Cron::Job#save` method and auto inject the
  Sentry::MonitorCheckIns module and turn monitoring on

part of #2134
sl0thentr0py added a commit that referenced this issue Nov 17, 2023
…he (#2170)

schedule

* optional patch under `sidekiq_cron`
* patch the `Sidekiq::Cron::Job#save` method and auto inject the
  Sentry::MonitorCheckIns module and turn monitoring on

part of #2134
@natikgadzhi
Copy link
Contributor

natikgadzhi commented Nov 19, 2023

Cool if I work on sidekiq-scheduler? Using #2170 as a reference, that's pretty straightforward.

UPD: #2172

@natikgadzhi
Copy link
Contributor

natikgadzhi commented Nov 20, 2023

Looking at Whenever, it's a bit funny:

All jobs are by default run with bash -l -c 'command...'. Among other things, this allows your cron jobs to play nice with RVM by loading the entire environment instead of cron's somewhat limited environment. Read more: http:https://blog.scoutapp.com/articles/2010/09/07/rvm-and-cron-in-production

You can change this by setting your own :job_template.

I think we can make our own wrapper that:

  1. Works as a rake task, and therefore loads Sentry configuration from the existing Rails app
  2. Starts, loads Sentry config, reports monitor check-in for the invoked command.
  3. Executes the actual command by shelling out
  4. If successful, reports successful monitor check-in.

I wonder if this should be configurable, so the user could opt-out of that behavior? I have a sneaky suspicion performance of starting a rake task only to ping Sentry, and then start another wrapped rake task could be not entirely great.

@sl0thentr0py
Copy link
Member Author

@natikgadzhi hmm if it's bash based, I'd leave that out of the scope of this task.
We already have CLI support here, so then they can just wrap their runs in sentry-cli.

@sl0thentr0py
Copy link
Member Author

clockwork is also fully unaware of what scheduling system is in use, so we can't do much there either, let's just ship the sidekiq stuff for now.

@natikgadzhi
Copy link
Contributor

natikgadzhi commented Nov 20, 2023 via email

@natikgadzhi
Copy link
Contributor

hmm if it's bash based, I'd leave that out of the scope of this task.
We already have CLI support here, so then they can just wrap their runs in sentry-cli.

If you're open to it, and if it'll be useful, I'm down to prepare a documentation PR to sentry-docs and README here that would cover how to plug crons monitoring for sidekiq-* and clockwork / whenever too.

@sl0thentr0py
Copy link
Member Author

@natikgadzhi of course, feel free to PR, help is always appreciated! We can collaborate on the docs PR if we need consistency with other platform docs. Let me know if you run in to problems.

@natikgadzhi
Copy link
Contributor

I'm starting to look at the docs — will mention you in a PR.

@natikgadzhi
Copy link
Contributor

Both sidekiq-cron and sidekiq-schedule support is merged!

@sl0thentr0py
Copy link
Member Author

alright can close this now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants