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 support for Java #2875

Closed
Tracked by #11
adinauer opened this issue Jul 31, 2023 · 6 comments · Fixed by #2946 or #2952
Closed
Tracked by #11

Crons support for Java #2875

adinauer opened this issue Jul 31, 2023 · 6 comments · Fixed by #2946 or #2952
Assignees

Comments

@adinauer
Copy link
Member

Problem Statement

We have a crons product so we could start sending check ins from the Java SDK.

Solution Brainstorm

  • Spring @scheduled
  • quartz library
  • investigate if there's more libs
@adinauer adinauer self-assigned this Aug 7, 2023
@buckett
Copy link
Contributor

buckett commented Aug 17, 2023

We have some jobs that are effectively docker containers running in AWS ECS on a schedule. Providing an easy way to send cron data back from these jobs would also be useful.

@adinauer
Copy link
Member Author

Hello @buckett I presume you're using Java in those containers? If so, which libraries are you using? Quartz? Spring?

@buckett
Copy link
Contributor

buckett commented Aug 17, 2023

@adinauer Yeah Java, they are Spring Boot, but the triggering of the containers is AWS, so it would be nice to have the ability to start a cron monitor when the Spring application context is initialised and then complete it when it is destroyed.

Or the hook could be against the JVM instead of binding against spring.

@adinauer
Copy link
Member Author

adinauer commented Aug 17, 2023

I guess that means you're not using @Scheduled or Quartz but instead the container starts on a schedule and executes some Spring application. I presume that's not a Web (WebMVC / WebFlux) application but a Spring CLI?

We'll consider the manually reporting CRONS use case when implementing.

One thing that might be tricky here is order of Sentry.init vs when to send the event.

@buckett
Copy link
Contributor

buckett commented Aug 17, 2023

It's basically a Spring CLI yeah. Manual reporting is basically what I'm after (through an API, we already have our own custom code that POST/PUTs to monitors and it would be nice to throw it away).

We do have other services that use quartz so if there's support for automatically setting up the monitors based on the quartz schedule and then reporting checks that would be great.

@adinauer
Copy link
Member Author

adinauer commented Sep 27, 2023

@buckett we're releasing we have released CRONS support for Java. 6.30.0 should be available soon is out.

Your container use case should be covered by either annotating your method with @SentryCheckIn("monitor_slug") or if that doesn't work using Sentry.captureCheckIn() manually.

We've also added support for Quartz but decided not to automatically create monitors for all jobs for now. If you're using Spring, all you need is to add the new sentry-quartz dependency and then on either your JobDetail or Trigger add a sentry-slug (also available as constant called SENTRY_SLUG_KEY) entry with your monitor slug to the job data map.

Docs will be published soonish. We've added something to our Spring Boot 3 and Spring Boot 2 samples.

We'd love your feedback!

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