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

Overview of @Scheduled methods (spring-boot-actuator) #8831

Closed
selimok opened this issue Apr 6, 2017 · 8 comments
Closed

Overview of @Scheduled methods (spring-boot-actuator) #8831

selimok opened this issue Apr 6, 2017 · 8 comments
Assignees
Labels
status: superseded An issue that has been superseded by another type: enhancement A general enhancement
Milestone

Comments

@selimok
Copy link

selimok commented Apr 6, 2017

We use @Scheduled annotation to schedule some tasks. But they are hidden at runtime and can be forgotten easily. It would be very nice to have an overview of all scheduled jobs and their cron values.

If spring-boot-actuator can provide an endpoint listing all scheduled methods we can monitor them via tools like spring-boot-admin (codecentric/spring-boot-admin#432)

Thanks.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 6, 2017
@iNikem
Copy link

iNikem commented May 4, 2017

This would be an extremely cool feature. We had in the past problems when some library unexpectedly added Sheduled class and an unwanted job ran in one of our applications. This overview of all jobs would make our troubleshooting much easier :)

@philwebb philwebb added priority: normal type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels May 17, 2017
@mballoni
Copy link

Really cool feature, indeed.
Gonna make some tests with custom actuator endpoints as a proof of concept.

@snicoll snicoll changed the title Feature Request: Overview of @Scheduled methods (spring-boot-actuator) Overview of @Scheduled methods (spring-boot-actuator) May 29, 2017
@philwebb
Copy link
Member

Closing in favor of PR #9623

@philwebb philwebb added status: duplicate A duplicate of another issue and removed priority: normal type: enhancement A general enhancement labels Jun 28, 2017
@wilkinsona wilkinsona reopened this Nov 14, 2017
@wilkinsona wilkinsona added priority: normal type: enhancement A general enhancement and removed status: duplicate A duplicate of another issue labels Nov 14, 2017
@wilkinsona wilkinsona added this to the 2.0.0.M7 milestone Nov 14, 2017
@wilkinsona wilkinsona self-assigned this Nov 14, 2017
@wilkinsona
Copy link
Member

Here's an example of the response from the new scheduledtasks endpoint:

HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v2+json;charset=UTF-8
Date: Wed, 15 Nov 2017 10:58:10 GMT
Transfer-Encoding: chunked

{
    "cron": [
        {
            "expression": "0 0 0/6 1/1 * ?",
            "runnable": {
                "target": "com.example.demo.MvcActuatorApplication.someCronTask"
            }
        },
        {
            "expression": "0 0 0/3 1/1 * ?",
            "runnable": {
                "target": "com.example.demo.MvcActuatorApplication$CronTriggeredRunnable"
            }
        }
    ],
    "fixedDelay": [
        {
            "initialDelay": 23,
            "interval": 12,
            "runnable": {
                "target": "com.example.demo.MvcActuatorApplication.someFixedDelayTask"
            }
        },
        {
            "initialDelay": 100,
            "interval": 100,
            "runnable": {
                "target": "com.example.demo.MvcActuatorApplication$FixedDelayRunnable"
            }
        }
    ],
    "fixedRate": [
        {
            "initialDelay": 67,
            "interval": 45,
            "runnable": {
                "target": "com.example.demo.MvcActuatorApplication.someFixedRateTask"
            }
        },
        {
            "initialDelay": 200,
            "interval": 200,
            "runnable": {
                "target": "com.example.demo.MvcActuatorApplication$FixedRateRunnable"
            }
        }
    ]
}

@selimok
Copy link
Author

selimok commented Nov 15, 2017

Hey cool, thank you very much for your effort :) It's a great feature.

@kamaydeo
Copy link

kamaydeo commented Jan 18, 2020

Does this work with tasks that are scheduled programmatically using TaskScheduler?

@wilkinsona
Copy link
Member

@kamaydeo No. You should use ScheduledTaskRegistrar rather than calling TaskScheduler directly.

@kamaydeo
Copy link

Thanks. That worked.
@Scheduled shows the method name in the /actuator/scheduledtasks. It would be great if ScheduledTaskRegistrar provided a way to specify the name of the scheduled task. When I used lambda with ScheduledTaskRegistrar, /actuator/scheduledtasks shows name of the lambda which is kinda not useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

7 participants