Skip to content
28 changes: 28 additions & 0 deletions docs/platforms/java/common/integrations/quartz.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,31 @@ Setting the monitor slug on the `Trigger` will override what is set on the `JobD
Setting a global job listener using a `SchedulerFactoryBeanCustomizer` in Spring Boot, will override the listener set by Sentry. For Sentry to work properly, you need to add a new `SentryJobListener` instance to the global job listeners.

</Alert>

## Monitor Config

From the next Sentry Java SDK release (after `8.60.0`), `SentryJobListener` sends a monitor config derived from the job's trigger with each check-in, so Sentry creates the monitor (or updates its schedule) from your code. This is on by default for every job that has a monitor slug.

The config is derived like this:

- `CronTrigger`: the cron expression and the trigger's time zone. The seconds field must be a fixed number, and the year field, if set, must be `*`.
- `SimpleTrigger` that repeats forever: the repeat interval, if it's a whole number of minutes.

Other triggers send no monitor config, and neither do triggers with a `Calendar`, jobs with more than one trigger, cron expressions with syntax Sentry doesn't support (such as `15W`, `L-3`, or wrap-around ranges like `FRI-MON`), a step after a day or month name (such as `MON/2`, which Quartz runs every Monday), or time zones that aren't IANA time zone IDs. For these, create the monitor in Sentry first. Whole-hour offsets such as `GMT+2` aren't affected: they're sent as `Etc/GMT-2`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Other triggers send no monitor config, and neither do triggers with a `Calendar`, jobs with more than one trigger, cron expressions with syntax Sentry doesn't support (such as `15W`, `L-3`, or wrap-around ranges like `FRI-MON`), a step after a day or month name (such as `MON/2`, which Quartz runs every Monday), or time zones that aren't IANA time zone IDs. For these, create the monitor in Sentry first. Whole-hour offsets such as `GMT+2` aren't affected: they're sent as `Etc/GMT-2`.
Monitor configuration isn't sent for any of the following:
- Other trigger types
- Triggers with a `Calendar`
- Jobs with multiple triggers
- Cron expressions that use syntax Sentry doesn't support, such as `15W`, `L-3`, or wraparound ranges like `FRI-MON`
- Cron expressions with a step after a day or month name, such as `MON/2` (which Quartz runs every Monday)
- Time zones that aren't IANA time zone IDs, except for whole-hour offsets such as `GMT+2`, which are sent as `Etc/GMT-2`
In these cases, create the monitor in Sentry first.


<Alert>

When you upgrade, monitors you created in Sentry take their schedule and time zone from the trigger. To keep managing a monitor's schedule in Sentry, turn the monitor config off for that job.

</Alert>

To turn it off for a job, set `SentryJobListener.SENTRY_UPSERT_MONITOR_CONFIG_KEY` to the string `"false"` in the job data map, next to the monitor slug. Like the slug, it also works in the trigger's job data map:

```java
Map<String, Object> jobData = new HashMap<>();
jobData.put(SentryJobListener.SENTRY_SLUG_KEY, "<monitor-slug>");
jobData.put(SentryJobListener.SENTRY_UPSERT_MONITOR_CONFIG_KEY, "false");

JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean();
jobDetailFactory.setJobDataAsMap(jobData);
```
Loading