-
-
Notifications
You must be signed in to change notification settings - Fork 188
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 timezone
support for Oban cron monitoring
#830
Comments
@savhappy @solnic I think it's time we consider a per-job configuration when necessary. One option is to do it via a behaviour that jobs (not just Oban jobs) can implement. The behaviour can be defmodule Sentry.CheckIn do
@callback sentry_check_in_configuration() :: (options_to_merge :: keyword())
# ...
end Then, an Oban worker could implement it like this: defmodule MyApp.Worker do
use Oban.Worker
@behaviour Sentry.CheckIn
@impl Oban.Worker
def process(...)
@impl Sentry.CheckIn
def sentry_check_in_configuration do
[timezone: "Europe/Berlin"]
end
end Then, integrations like the Oban one can essentially do: config =
if function_exported?(job.module, :sentry_check_in_configuration, 0) do
Keyword.merge(config, job.module.sentry_check_in_configuration())
else
config
end This is a basic approach, but I think it works and it's going to scale out pretty well. The callback could also take an argument that is decided by the integration itself, like @callbac sentry_check_in_configuration(info :: term()) :: keyword() In Oban's case, it would be the Thoughts? |
I can see this being useful (in general, not just for setting TZ for cron check-ins) but I'm wondering if this means you don't think that a top-level default for TZ that we could set via config would be a good idea? We could just have this: config :sentry,
# ...,
integrations: [
oban: [
cron: [enabled: true, time_zone: "Europe/Berlin"],
capture_errors: true
]
] ...and that could be overridden by a job's custom check-in config, what do you think? From what I see in the code, it seems doable, since we have |
It's doable but I would prioritize it lower than a per-job config (see also #829 which would be solved by the per-job config). |
This seems like a good use for a behaviour like @whatyouhide mentioned so we don't have to make additional considerations later. I can change the in-progress #829 to handle the new implementation. Or should we separate it? |
Sentry supports monitoring scheduled Oban jobs. I wanted to use this feature in my application to monitor Oban cron jobs, but Sentry always threw
A missed check-in was detected
errors. I looked into the problem and noticed in the web interface that the configured timezone for all cron monitors was set toUTC
while I configured the Oban cron jobs to use theEurope/Berlin
timezone. Therefore, I needed to change the timezone of the created cron monitors toEurope/Berlin
manually to be in sync with my jobs.I figured out that you can set the timezone with a Manual Setup, but I'd like to have a
timezone
setting for my config that allows me to set the timezone for the oban cron integrations. I would rather not do a manual setup only to set thetimezone
value.This is my setup:
The text was updated successfully, but these errors were encountered: