{"id":19001597,"url":"https://github.com/kevcodez/spring-boot-track-scheduled-tasks","last_synced_at":"2025-04-22T17:47:35.429Z","repository":{"id":91719537,"uuid":"133584335","full_name":"kevcodez/spring-boot-track-scheduled-tasks","owner":"kevcodez","description":"Keep track of scheduled tasks and their timings and exceptions in a Spring Boot 2 project","archived":false,"fork":false,"pushed_at":"2018-08-19T18:21:40.000Z","size":95,"stargazers_count":13,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T17:23:35.500Z","etag":null,"topics":["java","kotlin","scheduler","spring","spring-aop","spring-boot","spring-scheduling"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kevcodez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-15T23:33:19.000Z","updated_at":"2024-11-10T11:45:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"c863ce25-cb1e-455b-a7e9-9231168f7321","html_url":"https://github.com/kevcodez/spring-boot-track-scheduled-tasks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevcodez%2Fspring-boot-track-scheduled-tasks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevcodez%2Fspring-boot-track-scheduled-tasks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevcodez%2Fspring-boot-track-scheduled-tasks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevcodez%2Fspring-boot-track-scheduled-tasks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevcodez","download_url":"https://codeload.github.com/kevcodez/spring-boot-track-scheduled-tasks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249283002,"owners_count":21243656,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","kotlin","scheduler","spring","spring-aop","spring-boot","spring-scheduling"],"created_at":"2024-11-08T18:12:03.339Z","updated_at":"2025-04-16T22:31:18.957Z","avatar_url":"https://github.com/kevcodez.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# General\r\n\r\nThis project demonstrates the tracking of scheduled jobs using Spring AOP.\r\n\r\nThe tracking is fairly simple. The `ScheduledJobTrackingAspect` invokes every method with an `Scheduled` annotation and writes the start and end of the method into the `ScheduledJobTracker`.\r\nA UUID is assigned to the job upon start, since a single job can run multiple times at once.\r\n\r\nThe data is available via `ScheduledJobController`.\r\n\r\nThis is just a project demonstrating the tracking. I am considering to build a library that can be included in any spring boot project to enable tracking of scheduled tasks.\r\n\r\n## Sample scheduled job\r\n\r\nThe demo has a very simple scheduled job, that prints *foo* every 5 seconds.\r\n\r\n```kotlin\r\npackage com.example.demo\r\n\r\nimport org.springframework.scheduling.annotation.Scheduled\r\nimport org.springframework.stereotype.Component\r\n\r\n@Component\r\nclass ScheduledJob {\r\n\r\n    @Scheduled(fixedRate = 5000)\r\n    fun println() = println(\"foo\")\r\n\r\n}\r\n```\r\n\r\n## Access data via REST\r\n\r\n`GET /scheduled-jobs/`\r\n\r\n```json\r\n[\r\n  {\r\n    \"className\": \"com.example.demo.ScheduledJob\",\r\n    \"methodName\": \"println\",\r\n    \"fixedRate\": 5000,\r\n    \"runs\": [\r\n      {\r\n        \"uuid\": \"c5ca5c73-f1f6-4ced-a911-de0e43a78d78\",\r\n        \"startedAt\": \"2018-05-15T23:38:11.177Z\",\r\n        \"endedAt\": \"2018-05-15T23:38:11.182Z\",\r\n        \"exception\": null,\r\n        \"duration\": \"PT0.005S\"\r\n      },\r\n      {\r\n        \"uuid\": \"2dd54fc3-8753-41c1-91d2-a7ec33fda0e8\",\r\n        \"startedAt\": \"2018-05-15T23:38:16.169Z\",\r\n        \"endedAt\": \"2018-05-15T23:38:16.169Z\",\r\n        \"exception\": null,\r\n        \"duration\": \"PT0S\"\r\n      },\r\n      {\r\n        \"uuid\": \"6be5d3ad-924e-4aa6-aef8-a4b837b3e67f\",\r\n        \"startedAt\": \"2018-05-15T23:38:21.170Z\",\r\n        \"endedAt\": \"2018-05-15T23:38:21.170Z\",\r\n        \"exception\": null,\r\n        \"duration\": \"PT0S\"\r\n      },\r\n      {\r\n        \"uuid\": \"72dc2d85-d2f1-4875-9381-3d26f6c6512c\",\r\n        \"startedAt\": \"2018-05-15T23:38:26.169Z\",\r\n        \"endedAt\": \"2018-05-15T23:38:26.169Z\",\r\n        \"exception\": null,\r\n        \"duration\": \"PT0S\"\r\n      },\r\n      {\r\n        \"uuid\": \"e4f635ee-625b-4618-84ee-0cb0c2aa210e\",\r\n        \"startedAt\": \"2018-05-15T23:38:31.169Z\",\r\n        \"endedAt\": \"2018-05-15T23:38:31.169Z\",\r\n        \"exception\": null,\r\n        \"duration\": \"PT0S\"\r\n      }\r\n    ],\r\n    \"status\": \"Idle\",\r\n    \"averageDurationInMs\": 1,\r\n    \"lastDurationInMs\": 0,\r\n    \"lastRunStarted\": \"2018-05-15T23:38:31.169Z\",\r\n    \"lastRunEnded\": \"2018-05-15T23:38:31.169Z\"\r\n  }\r\n]\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevcodez%2Fspring-boot-track-scheduled-tasks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevcodez%2Fspring-boot-track-scheduled-tasks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevcodez%2Fspring-boot-track-scheduled-tasks/lists"}