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

Enhancement Request: Improve Job Listing API for Better Usability and Maintenance #30667

Open
fabrizzio-dotCMS opened this issue Nov 15, 2024 · 0 comments

Comments

@fabrizzio-dotCMS
Copy link
Contributor

Parent Issue

#29498

User Story

The current implementation of the /api/v1/jobs/completed endpoint returns detailed job results for completed jobs, including extensive error logs and metadata. This creates unnecessary overhead when listing or paginating through large numbers of completed jobs, particularly when dealing with jobs that have many errors or warnings.

For example, a large import job with errors generates a response like this:

{
"progress": 1.0,
"queueName": "importContentlets",
"result": {
"errorDetail": null,
"metadata": {
"errors": [
"Line #2 contains errors. URL is malformed or Response is not 200",
"Line #3 contains errors. URL is malformed or Response is not 200",
...
],
"warnings": [
"Header 'languageCode' doesn't match any Content Type field; this column of data will be ignored.",
...
],
...
}
},
...
}

it's extensively large like 800 lines

Acceptance Criteria

Proposed Enhancements:

1.	Summarized Responses for Listing Endpoints:
	Modify the /api/v1/jobs/completed (and similar endpoints for failed jobs) to return summary data only.
	Include key attributes such as:
	id
	state
	progress
	queueName
	startedAt
	updatedAt

	Omit detailed metadata, warnings, and errors to reduce response size.

2.	Detailed Endpoint for Job Data:
	Full info should only be returned through a dedicated job, e.g., /api/v1/jobs/{jobId}, to return the full details of a specific job.
	This lets clients fetch detailed information on demand for a specific job without overloading listing endpoints.

3.	Cleanup Endpoint for Old Jobs:
	Add an endpoint to clean up old or failed jobs, e.g., /api/v1/jobs/cleanup, with parameters for filtering (e.g., state, date range).
	This would help manage and maintain job history efficiently, avoiding performance issues caused by accumulating old data.

Benefits:

	Improved Performance: Paginated endpoints will be faster and lighter by omitting unnecessary data.
	Better Usability: Developers can focus on the summaries for listings and retrieve details only when needed.
	Enhanced Maintenance: A cleanup endpoint helps avoid bloated job histories, ensuring the system remains performant over time.

Affected Endpoints:

•	/api/v1/jobs/completed
•	/api/v1/jobs/failed

Proposed Objective

Technical User Experience

Proposed Priority

Priority 3 - Average

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Next 1-3 Sprints
Development

No branches or pull requests

1 participant