Skip to content

Added limit to history in Supervisor#18416

Merged
cryptoe merged 7 commits intoapache:masterfrom
vogievetsky:add_history_limit
Aug 30, 2025
Merged

Added limit to history in Supervisor#18416
cryptoe merged 7 commits intoapache:masterfrom
vogievetsky:add_history_limit

Conversation

@vogievetsky
Copy link
Copy Markdown
Contributor

@vogievetsky vogievetsky commented Aug 18, 2025

This prevents the web console from choking if there is a ton of supervisor history.

Unlike my usual console PRs I am actually modifying the Java API for supervisor/<id>/history to have a count parameter. I called it limit at first but renamed it to count to match other history APIs.

Comment thread docs/api-reference/supervisor-api.md Outdated
#### Query parameters

* `count` (optional)
* Maximum number of history entries to return. If not specified, returns all history entries.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might want to call out the sorting order here. No ?

Assert.assertEquals(Collections.emptyList(), response.getEntity());

// Test with negative limit
response = supervisorResource.specGetHistory(request, "id1", -1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should count <=0 be a bad request ie 400 ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated!

@cryptoe
Copy link
Copy Markdown
Contributor

cryptoe commented Aug 20, 2025

Thanks for taking this up @vogievetsky !!

Copy link
Copy Markdown
Contributor

@cryptoe cryptoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment.
Other than that lgtm.

public List<VersionedSupervisorSpec> getAllForId(String id, @Nullable Integer limit) throws IllegalArgumentException
{
if (limit != null && limit <= 0) {
throw new IllegalArgumentException("Limit must be greater than zero if set");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The end user is setting count but the exception message received by the end user is talking about limit.
Since there can always be a variable name change, what we could do is to this check in the :

that way we could control the end user message better.

Nit: We might want to add the limit passed just to aid debugging.

@vogievetsky
Copy link
Copy Markdown
Contributor Author

vogievetsky commented Aug 25, 2025

Added validation to supervisor resource. Not sure where to put the limit in the debugging... there isn't an existing log statement

@cryptoe cryptoe merged commit a8fe82d into apache:master Aug 30, 2025
70 checks passed
@cryptoe
Copy link
Copy Markdown
Contributor

cryptoe commented Aug 30, 2025

Thanks for the PR. 🚀

@vogievetsky vogievetsky deleted the add_history_limit branch September 23, 2025 19:44
@cecemei cecemei added this to the 35.0.0 milestone Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants