Skip to content

chore: reworked stats collector to be based on vertx route handler to be abl… - #2739

Merged
rsynek merged 1 commit into
TimefoldAI:mainfrom
mswiderski:improve-stats-collector-for-shutdown
Oct 9, 2026
Merged

rsynek merged 1 commit into
TimefoldAI:mainfrom
mswiderski:improve-stats-collector-for-shutdown

Conversation

@mswiderski

@mswiderski mswiderski commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

…e to catch all requests/responses

@mswiderski
mswiderski requested review from a team and a balanced review from Copilot October 8, 2026 09:44

Copilot AI left a comment

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.

🟡 Changes recommended

Shutdown can race with completion updates or remain deferred indefinitely by an unfinished request.

2 open findings
What changed in this PR

Moves request tracking from REST filters to Vert.x routing so worker shutdown accounts for more request and response paths.

Changes:

  • Tracks active requests and their latest activity, excluding probes and event streams.
  • Updates delayed shutdown to use the new statistics.
  • Adds lifecycle tests and test dependencies.
File Description
service/​worker/​src/​main/​java/​ai/​timefold/​solver/​service/​worker/​impl/​ShutdownExecutor.java Uses active-request counts and activity timestamps for shutdown.
service/​rest/​src/​test/​java/​ai/​timefold/​solver/​service/​rest/​impl/​stats/​StatisticsCollectorImplTest.java Tests completion, failure, disconnects, and exclusions.
service/​rest/​src/​main/​java/​ai/​timefold/​solver/​service/​rest/​impl/​stats/​StatisticsCollectorImpl.java Implements router-level request tracking.
service/​rest/​pom.xml Adds test dependencies.
service/​definition/​src/​main/​java/​ai/​timefold/​solver/​service/​definition/​internal/​stats/​StatisticsCollector.java Exposes request counts and activity timestamps.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Copilot AI balanced review requested due to automatic review settings October 8, 2026 10:05
@mswiderski
mswiderski force-pushed the improve-stats-collector-for-shutdown branch from 0c45875 to 5f0863e Compare October 8, 2026 10:06

Copilot AI left a comment

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.

🔵 Needs a closer look

The event-stream exclusion can leave ordinary uploads untracked and vulnerable to shutdown.

0 open findings

2 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Restrict event route exemption to GET requests

service/​rest/​src/​main/​java/​ai/​timefold/​solver/​service/​rest/​impl/​stats/​StatisticsCollectorImpl.java:67

For a model exposed at /v1/events (allowed by TimefoldModelDescriptorProcessor#getResourceTypeFromPath), this suffix check also excludes ordinary POST uploads from activity tracking, allowing the worker to shut down during an upload when its idle delay expires; restrict the exemption to actual GET /{id}/events routes.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Copilot AI balanced review requested due to automatic review settings October 8, 2026 10:12

Copilot AI left a comment

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.

🟡 Changes recommended

A request-path edge case can still cause event streams to delay worker shutdown.

1 open finding

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Copilot AI balanced review requested due to automatic review settings October 8, 2026 10:31
@mswiderski
mswiderski force-pushed the improve-stats-collector-for-shutdown branch from 5f0863e to 293601f Compare October 8, 2026 10:31
@mswiderski mswiderski changed the title reworked stats collector to be based on vertx route handler to be abl… chore: reworked stats collector to be based on vertx route handler to be abl… Oct 8, 2026

Copilot AI left a comment

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.

🟢 Approval recommended

No blocking defects were identified in the tracking implementation or shutdown integration.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@rsynek rsynek left a comment

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.

One comment - up to you if you decide to take it up, as it hasn't been introduced by this PR.

Copilot AI balanced review requested due to automatic review settings October 9, 2026 14:28
@mswiderski
mswiderski force-pushed the improve-stats-collector-for-shutdown branch from 293601f to b16f049 Compare October 9, 2026 14:28
@rsynek
rsynek removed the request for review from Copilot October 9, 2026 14:30
@rsynek
rsynek merged commit 142276e into TimefoldAI:main Oct 9, 2026
39 checks passed

This branch was successfully deployed

1 active deployment
internal — b16f0498 Deployed Oct 9, 2026 by mswiderski via approval_required #987
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants