Skip to content

Jobs

Jobs are scheduled executions of job definitions that run components in the background. Jobs capture the result of each execution which can be fetched over API. Jobs are also available in the Graph allowing easy oversight of what is happening in the system.

Jobs can be created in multiple ways:

Retention

Jobs are generally stored for 14 days after they have finished, after which they are deleted.

Monitoring & Statistics

The Jobs system provides detailed statistics for monitoring job execution and performance. Statistics are aggregated per-minute and can be queried via the REST API.

Available Metrics

Each statistic bucket includes:

  • Execution Counts: Number of jobs scheduled, successfully completed, and failed
  • Performance Metrics: Minimum, maximum, and average execution times (in milliseconds)
  • Queue Monitoring: Snapshot of cache queue depth and total queue depth

Querying Statistics

Statistics can be queried using GET /resources/jobs/statistics:

GET /resources/jobs/statistics?from=2025-11-14T00:00:00Z&to=2025-11-14T23:59:59Z

Query Parameters:

  • from (optional): Start time for statistics (defaults to 24 hours ago)
  • to (optional): End time for statistics (defaults to current time)
  • jobDefinitionId (optional): Filter to specific job definition

Response Example:

[
{
"jobDefinitionId": "send-email",
"bucketTime": "2025-11-14T14:30:00Z",
"scheduled": 45,
"successful": 43,
"failed": 2,
"minExecution": 120.5,
"maxExecution": 2340.8,
"avgExecution": 450.3,
"cacheQueueDepth": 12,
"totalQueueDepth": 67
}
]

Common Monitoring Scenarios

Track Job Performance:

GET /resources/jobs/statistics?jobDefinitionId=send-email&from=2025-11-14T00:00:00Z

Monitor Failure Rates: Query statistics and compare failed vs successful counts to identify problematic periods.

Identify Performance Bottlenecks: Look for high avgExecution times or increasing queue depths to spot performance issues before they become critical.

Queue Depth Monitoring: Track totalQueueDepth to ensure your job processing capacity matches demand. Rising queue depths may indicate need for scaling.

Authorization

Statistics follow job-level permissions. You can view statistics for jobs you have permission to read. If you have global job statistics permission, you can view statistics across all job definitions.

Access Control

Jobs inherit the permissions from the respective component. So if you have access to invoke a component method (for example via an ingress), you automatically have access to schedule the call using a Job.

Job statistics follow the same permission model - you can view statistics for any jobs you have permission to execute or monitor.