-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Add Quartz actuator endpoint #10364
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 Quartz actuator endpoint #10364
Conversation
See also #9623 |
647fb5c
to
e99ff64
Compare
I suspect we'll want a single endpoint that provides information about quartz scheduling and "normal" scheduling. We'll consider this one once the Framework changes blocking #9623 are available. |
Thanks for the feedback. How would the actual response payload look in the case these two are combined? Obviously the model of the scheduling related entities differs quite a bit between the two so I doubt it will be possible to fit them into the same representation. Something like this comes in mind:
However I'm not sure I like that since at some point we could support operations other than reads. There's also the question of disabling the information from specific scheduler - for example user would like to have Quartz scheduling report but not Spring scheduling. All of this adds complexity to endpoint if it's a single one. OTOH this could be viewed from the perspective of Flyway/Liquibase endpoints - both are database migration tools yet there are separate endpoints. |
e99ff64
to
d6fb4ef
Compare
With #8831 resolved, are there any ideas with regard to the direction this PR will be taking? |
@vpavic Having implemented the new scheduled tasks endpoint and what you're proposing here, I'm now in agreement with keeping them separate. I'd quite like to get this into 2.0 if we can. One thing that would help with that is adding some documentation for the endpoint along the lines of what's just be done in 4de208b. Do you have time to take a look at that? |
Yes, I should be able to take care of that over the next few days. |
d6fb4ef
to
9c5c594
Compare
@wilkinsona I've added the endpoint docs. |
@vpavic Thanks for the docs. What was the motivation for splitting the endpoint into two operations? Perhaps retrieving details of all the scheduled jobs is prohibitively expensive when using Quartz? I'm leaning towards reworking this to provide a single operation that shows details of all the scheduled jobs. I think it would make the endpoint easier to use and would also bring it into line with the schedulers endpoint. |
Having looked at this some more, I'm wondering if the endpoint should present jobs and triggers as two separate, top-level concerns. That would open up the possibility of having separate operations for manipulating jobs and triggers in the future. In web terms, something like the following:
Then, in the future, we could introduce the following:
Beyond that, I could also see operations for pausing or resuming whole groups:
|
Thanks for the feedback @wilkinsona. The idea of splitting the endpoint into two operations originates from the chat @snicoll and I had shortly after #4299 was merged. Personally I'm still in favor of such arrangement as listing all the jobs can indeed be quite a costly operation. For each job, we need to go to I'd also avoid looking at Quartz endpoint through comparison with Schedulers endpoint as the two are quite different in nature - the latter usually contains a smaller set of jobs that are static and not backed by a external store, while the former is dynamic and can contain hundreds or even thousands of jobs at a given moment. |
Thanks, @vpavic. I’m rather sceptical that the cost would be prohibitive but do realise it could be the case. IMO, as things stand, the changes proposed here are compromising the usability of the endpoint for a theoretical performance problem. Until the performance cost has been quantified and found to be too large, I don’t think that compromise is justified. Even if the cost is relatively high, endpoint response caching will mitigate it to some degree. Unfortunately, time is running out for RC1 and I don’t have time to gather performance data that would inform the design of the endpoint. I’m going to drop this from RC1 as I’d rather this landed in 2.1 having been carefully considered than we rush it into 2.0 and regret it. |
To make progress, this PR requires the following:
|
return new QuartzJob(jobDetail, triggers); | ||
} | ||
catch (SchedulerException e) { | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, I new here. So this is just a question why we didn't log what is the error?
#17836 shows that the performance of the preferred structure isn't a problem. Thanks for your efforts here, @vpavic, but I think it makes sense to close this one at this point in favour of #17836. |
I've rebased this change on top of |
This commit reworks the initial proposal so that jobs and triggers are treated as first class concepts. `/actuator/quartz` now returns the group names for jobs and triggers. `actuator/quartz/jobs` returns the job names, keyed by the available group names, while `/actuator/quartz/triggers` does the same for triggers. `/actuator/jobs/{groupName}` provides an overview of a job group. It provides a map of job names with the class name of the job. implementation `/actuator/triggers/{groupName}` provides an overview of a trigger group. There are five supported trigger implementations: cron, simple, daily time interval, calendar interval, and custom for any other implementation. Given that each implementation has specific settings, triggers are split in five objects. `/actuator/jobs/{groupName}/{jobName}` provides the full details of a particular job. This includes a sanitized data map and a list of triggers ordered by next fire time. `/actuator/triggers/{groupName}/{triggerName}` provides the full details of a particular trigger. This includes the state, its type, and a dedicate object containing implementation-specific settings. See gh-10364
This PR adds Actuator endpoint that lists Quartz Scheduler jobs and allows retrieval of their details.
The updated
spring-boot-sample-quartz
sample can be used to try out the new endpoint.