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 information in Quartz job detail #43226

Open
snicoll opened this issue Nov 20, 2024 · 2 comments
Open

Add execution information in Quartz job detail #43226

snicoll opened this issue Nov 20, 2024 · 2 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@snicoll
Copy link
Member

snicoll commented Nov 20, 2024

Reviewing #43086 and brainstorming with @wilkinsona we believe that the detail of a job should specify whether it's running or not and additional information if it is.

Doing so will help with triggering a new execution on demand.

The detail of a test job is currently as follows:

{
    "className": "com.example.demoquartz.DemoQuartzApplication$TestJob",
    "data": {},
    "durable": true,
    "group": "DEFAULT",
    "name": "testJob",
    "requestRecovery": false,
    "triggers": [
            "group": "DEFAULT",
            "name": "testJobTrigger",
            "nextFireTime": "2024-11-20T10:26:43.791+00:00",
            "previousFireTime": "2024-11-20T10:25:43.791+00:00",
            "priority": 5
    ]
}

For a Job who's currently running, we'd like the description to improve as follows:

{
  "className": "com.example.demoquartz.DemoQuartzApplication$TestJob",
  "data": {},
  "durable": true,
  "group": "DEFAULT",
  "name": "testJob",
  "requestRecovery": false,
  "running": true,
  "triggers": [
    {
      "executions": {
        "previous": "2024-11-20T10:25:43.791+00:00",
        "next": "2024-11-20T10:26:43.791+00:00",
        "current": {
          "fireTime": "2024-11-20T10:25:43.794+00:00",
          "recovering": false,
          "refireCount": 0
        }
      },
      "group": "DEFAULT",
      "name": "testJobTrigger",
      "priority": 5
    }
  ]
}

If the job is not running, it would be:

{
  "className": "com.example.demoquartz.DemoQuartzApplication$TestJob",
  "data": {},
  "durable": true,
  "group": "DEFAULT",
  "name": "testJob",
  "requestRecovery": false,
  "running": false,
  "triggers": [
    {
      "executions": {
        "previous": "2024-11-20T10:25:43.791+00:00",
        "next": "2024-11-20T10:26:43.791+00:00",
      },
      "group": "DEFAULT",
      "name": "testJobTrigger",
      "priority": 5
    }
  ]
}

For backward compatible reason, the nextFireTime and previousFireTime should still be present but we'll stop documenting them.

@wilkinsona
Copy link
Member

For consistency, I wonder if we should have some common structure for the executions:

"executions": {
  "previous": {
    "fireTime": "2024-11-20T10:25:43.791+00:00"
  },
  "next": {
    "fireTime": "2024-11-20T10:26:43.791+00:00"
  },
  "current": {
    "fireTime": "2024-11-20T10:25:43.794+00:00",
    "recovering": false,
    "refireCount": 0
  }
},

@snicoll
Copy link
Member Author

snicoll commented Nov 20, 2024

Current proposal is as follows for http :8080/actuator/quartz/jobs/DEFAULT/testJob:

HTTP/1.1 200
Connection: keep-alive
Content-Type: application/vnd.spring-boot.actuator.v3+json
Date: Wed, 20 Nov 2024 15:13:17 GMT
Keep-Alive: timeout=60
Transfer-Encoding: chunked

{
    "className": "com.example.demoquartz.DemoQuartzApplication$TestJob",
    "data": {},
    "durable": true,
    "group": "DEFAULT",
    "name": "testJob",
    "requestRecovery": false,
    "running": true,
    "triggers": [
        {
            "executions": {
                "current": {
                    "fireTime": "2024-11-20T15:13:11.459+00:00",
                    "recovering": false,
                    "refireCount": 0
                },
                "next": {
                    "fireTime": "2024-11-20T15:14:11.225+00:00"
                },
                "previous": {
                    "fireTime": "2024-11-20T15:13:11.225+00:00"
                }
            },
            "group": "DEFAULT",
            "name": "testJobTrigger",
            "nextFireTime": "2024-11-20T15:14:11.225+00:00",
            "previousFireTime": "2024-11-20T15:13:11.225+00:00",
            "priority": 5
        }
    ]
}

snicoll added a commit to snicoll/spring-boot that referenced this issue Nov 20, 2024
This commit improves the Quartz Actuator endpoint to specify whether a
particular job is running. For a job that's running, the related trigger
has some details such as the fire time, whether it's recovering and the
re-fire count.

To make things more consistent, the detail of a trigger has now an
executions that contains detail about the previous, current, and next
executions.

Closes spring-projectsgh-43226
snicoll added a commit to snicoll/spring-boot that referenced this issue Nov 20, 2024
This commit improves the Quartz Actuator endpoint to specify whether a
particular job is running. For a job that's running, the related trigger
has some details such as the fire time, whether it's recovering and the
re-fire count.

To make things more consistent, the detail of a trigger has now an
executions that contains detail about the previous, current, and next
executions.

Closes spring-projectsgh-43226
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants