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

Add execution metadata to scheduled tasks #24560

Closed
bclozel opened this issue Feb 20, 2020 · 1 comment
Closed

Add execution metadata to scheduled tasks #24560

bclozel opened this issue Feb 20, 2020 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Feb 20, 2020

@enesify requested an enhancement on Spring Boot, where actuator endpoints could provide more information about scheduled tasks.

Currently, the /actuator/scheduledtasks actuator endpoint provides information about scheduled tasks, including their type, target and scheduling information.

The enhancement request would require more metadata being present on the tasks themselves, such as:

  • last Execution Time
  • last Execution Status
  • next Execution Time

The issue also requests the ability to change a cron expression or to manually trigger a task. For that, Spring Boot would need a unique identifier for each task, which they don't have at the moment.

See spring-projects/spring-boot#17585 for context.

@bclozel bclozel added status: waiting-for-triage An issue we've not yet triaged or decided on in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels Feb 20, 2020
@bclozel bclozel added this to the 6.x Backlog milestone May 12, 2022
@jhoeller jhoeller removed the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 14, 2023
@snicoll snicoll self-assigned this Jan 4, 2024
@snicoll
Copy link
Member

snicoll commented Jan 17, 2024

The issue also requests the ability to change a cron expression or to manually trigger a task. For that, Spring Boot would need a unique identifier for each task, which they don't have at the moment.

We'd rather expose the metadata only for now as a first step.

@snicoll snicoll modified the milestones: 6.x Backlog, 6.2.x Jan 17, 2024
@snicoll snicoll removed their assignment Apr 30, 2024
@bclozel bclozel self-assigned this May 13, 2024
@bclozel bclozel modified the milestones: 6.2.x, 6.2.0-M4 Jun 11, 2024
jhoeller added a commit that referenced this issue Jun 12, 2024
Includes defensive test arrangement for isInThePast() with at least 1 ms having passed.

See gh-24560
snicoll pushed a commit to snicoll/spring-boot that referenced this issue Jun 19, 2024
Spring Framework wraps `Task` and `ScheduledTask` runnables to collect
and share metadata about task execution and scheduling.
The `ScheduledTasksEndpoint` descriptors were relying on the fact that
tasks would never be wrapped. Spring Framework already wrapped runnables
in various cases, for methods returning `Callable` or reactive types.

This commit makes use of the `toString()` method to describe the
runnable. Runnable implementations can override this method for
displaying purposes on the actuator endpoint.

See spring-projects/spring-framework#24560
wilkinsona pushed a commit to spring-projects/spring-boot that referenced this issue Jun 20, 2024
Spring Framework wraps `Task` and `ScheduledTask` runnables to collect
and share metadata about task execution and scheduling.
The `ScheduledTasksEndpoint` descriptors were relying on the fact that
tasks would never be wrapped. Spring Framework already wrapped runnables
in various cases, for methods returning `Callable` or reactive types.

This commit makes use of the `toString()` method to describe the
runnable. Runnable implementations can override this method for
displaying purposes on the actuator endpoint.

See spring-projects/spring-framework#24560
See gh-41177
bclozel added a commit to spring-projects/spring-boot that referenced this issue Jul 25, 2024
As of spring-projects/spring-framework#24560, Spring provides additional
metadata for scheduled tasks:
* next execution time
* last execution outcome (including status, time and raised exception)

This commit leverages this information to enhance the existing
`scheduledtasks` Actuator endpoint.

Closes gh-17585
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants