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

HTM-1227: allow monitoring of triggered jobs through Sentry #990

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,11 @@ SPDX-License-Identifier: MIT
<artifactId>sentry-jdbc</artifactId>
<version>${sentry.version}</version>
</dependency>
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-quartz</artifactId>
<version>${sentry.version}</version>
</dependency>
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
package org.tailormap.api.configuration;

import io.sentry.quartz.SentryJobListener;
import jakarta.annotation.PostConstruct;
import java.lang.invoke.MethodHandles;
import org.quartz.SchedulerException;
Expand All @@ -29,6 +30,10 @@

@PostConstruct
public void addListeners() throws SchedulerException {
schedulerFactoryBean
.getScheduler()
.getListenerManager()
.addJobListener(new SentryJobListener());

Check warning on line 36 in src/main/java/org/tailormap/api/configuration/SchedulerConfiguration.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/tailormap/api/configuration/SchedulerConfiguration.java#L33-L36

Added lines #L33 - L36 were not covered by tests
if (logger.isDebugEnabled()) {
// Add debug logging listeners to the scheduler
schedulerFactoryBean
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/tailormap/api/scheduling/TaskCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
package org.tailormap.api.scheduling;

import static io.sentry.quartz.SentryJobListener.SENTRY_SLUG_KEY;

import java.lang.invoke.MethodHandles;
import java.util.UUID;
import org.quartz.CronScheduleBuilder;
Expand Down Expand Up @@ -62,6 +64,7 @@
.withIdentity(jobDetail.getKey().getName(), jobDetail.getKey().getGroup())
.startAt(DateBuilder.futureDate(30, DateBuilder.IntervalUnit.SECOND))
.withPriority(jobData.getPriority())
.usingJobData(SENTRY_SLUG_KEY, "monitor_slug_cron_trigger_" + jobData.get("type"))

Check warning on line 67 in src/main/java/org/tailormap/api/scheduling/TaskCreator.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/tailormap/api/scheduling/TaskCreator.java#L67

Added line #L67 was not covered by tests
.withSchedule(
CronScheduleBuilder.cronSchedule(cronExpression)
.withMisfireHandlingInstructionFireAndProceed())
Expand Down
Loading