-
-
Notifications
You must be signed in to change notification settings - Fork 494
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
Add Sentry::Cron::MonitorCheckIns
module for automatic monitoring of jobs
#2130
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2130 +/- ##
==========================================
- Coverage 97.30% 97.27% -0.03%
==========================================
Files 96 89 -7
Lines 3596 3342 -254
==========================================
- Hits 3499 3251 -248
+ Misses 97 91 -6
|
6fc5f85
to
3dab5f8
Compare
…f jobs Standard job frameworks such as `ActiveJob` and `Sidekiq` can now use this module to automatically capture check ins. ```rb class ExampleJob < ApplicationJob include Sentry::Cron::MonitorCheckIns sentry_monitor_check_ins def perform(*args) # do stuff end end ``` ```rb class SidekiqJob include Sidekiq::Job include Sentry::Cron::MonitorCheckIns sentry_monitor_check_ins def perform(*args) # do stuff end end ``` You can pass in optional attributes to `sentry_monitor_check_ins` as follows. ```rb sentry_monitor_check_ins slug: 'custom_slug' sentry_monitor_check_ins monitor_config: Sentry::Cron::MonitorConfig.from_interval(1, :minute) sentry_monitor_check_ins monitor_config: Sentry::Cron::MonitorConfig.from_crontab('5 * * * *') ```
3dab5f8
to
571e522
Compare
👋 Hello and apologies if this is the wrong place to ask, but I upgraded my gems today and was excited to see this new feature. However, after deploying and having some Sidekiq jobs running, I'm not seeing anything in the Sentry web interface. In reading the docs, I'm unclear if I need to do additional work (perhaps visiting /crons and then clicking "Add Monitor") or should I see the cron monitors appear automatically if I've done the |
you need to either Add Monitor in the UI or add a |
Thank you for the info! Just to follow up a bit, I do have the following: class Api::ExampleJob
include Sidekiq::Job
include Sentry::Cron::MonitorCheckIns
sentry_monitor_check_ins monitor_config: Sentry::Cron::MonitorConfig.from_crontab("0 * * * * *") ...but I'm gathering from other GH chatter that perhaps I need to include a monitor_config = Sentry::Cron::MonitorConfig.from_crontab(
"0 * * * * *",
slug: "example_job"
) I'd prefer to try to auto-configure these, so I don't have to use the web interface for other monitors, so I'm curious what else would be required. I believe the relevant docs I think could use additional detail would be here: https://docs.sentry.io/platforms/ruby/crons/#job-monitoring I appreciate the help, thank you! |
Yeah this should be made clear in the docs, sorry about that. sentry_monitor_check_ins monitor_config: Sentry::Cron::MonitorConfig.from_crontab("0 * * * * *") this will work, it'll set the slug to the job class name. Or you can do the following for a custom slug sentry_monitor_check_ins slug: "example_job", monitor_config: Sentry::Cron::MonitorConfig.from_crontab("0 * * * * *") |
Gotcha, so I think I'm all set? Perhaps my confusion is just that I expected to see something on (Apologies for the chatter here, just trying to help with the beta feedback!) |
np! always happy to hear feedback and this is quite new so we're still iterating.
if you've pushed this out, you should see check-ins start appearing in the Crons section in the product. And error statuses will get logged into Issues as well. |
Hmm, perhaps a bug, or I didn't configure things correctly. Let me know if I should contact support or via email, but the relevant project ID is 294023, I'm using sentry-rails (5.12.0) and the relevant code change is: class Api::RedisHitCounterDbSyncJob
include Sentry::Cron::MonitorCheckIns
sentry_monitor_check_ins monitor_config: Sentry::Cron::MonitorConfig.from_crontab("0 * * * * *") ...and I think I'm seeing the blank slate view on the |
that should work, can you make another issue with some details if possible? |
Standard job frameworks such as
ActiveJob
andSidekiq
can now use this module to automatically capture check ins.You can pass in optional attributes to
sentry_monitor_check_ins
as follows.part of #2090