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

Trip Monitor analyzer improvement, status log #199

Merged
merged 8 commits into from
Dec 11, 2023

Conversation

binh-dam-ibigroup
Copy link
Collaborator

@binh-dam-ibigroup binh-dam-ibigroup commented Nov 30, 2023

Checklist

  • Appropriate branch selected (all PRs must first be merged to dev before they can be merged to master)
  • Any modified or new methods or classes have helpful JavaDoc and code is thoroughly commented
  • [na] The description lists all applicable issues this PR seeks to resolve
  • [na] The description lists any configuration setting(s) that differ from the default settings
  • All tests and CI builds passing

Description

This PR improves the performance of the trip monitoring job (and reduces the risk of bugs from dropped Mongo connections) and adds logging to inform when trip analysis queues and states remain non-empty/non-idle for too long.

@binh-dam-ibigroup binh-dam-ibigroup changed the title Trip Monitor analyzer improvement, log status Trip Monitor analyzer improvement, status log Nov 30, 2023
Copy link
Contributor

@br648 br648 left a comment

Choose a reason for hiding this comment

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

Good updates. Some minor comments, but approving.

// Performance note: Don't retrieve the full data for each trip at this time.
// This saves bandwidth and memory, as we don't use the trip data immediately besides the ID.
// The full data for each trip will be fetched at the time the actual analysis takes place.
// TODO: Filter out trips that would be skipped by the CheckMonitoredTrip.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this TODO be done now? If not, perhaps explain why. TODOs seem to have a habit of not getting done.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, thank you, I added one criterion in ca89702 and reworded the TODO.

queueIterations++;
// Report queue status every minute (unless this job finishes before).
int runMillis = queueIterations * BLOCKING_QUEUE_DEPLETE_WAIT_TIME_MILLIS;
if ((runMillis % 60000) == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could create a constant for 60000 and use here and further down.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Refactored in ca89702.

@@ -17,27 +17,27 @@ public class MonitoredTripLocks {
/** the amount of time in milliseconds to wait to check if a lock has been released */
private static final int LOCK_CHECK_WAIT_MILLIS = 500;

private static final ConcurrentHashMap<MonitoredTrip, Boolean> locks = new ConcurrentHashMap();
private static final ConcurrentHashMap<String, Boolean> locks = new ConcurrentHashMap();
Copy link
Contributor

Choose a reason for hiding this comment

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

SonarLint: Update to new ConcurrentHashMap<>()

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Refactored in ca89702.

@br648 br648 assigned binh-dam-ibigroup and unassigned br648 Dec 1, 2023
Copy link
Contributor

@JymDyerIBI JymDyerIBI left a comment

Choose a reason for hiding this comment

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

👍 Looks good.

@binh-dam-ibigroup binh-dam-ibigroup merged commit fd0d143 into dev Dec 11, 2023
2 checks passed
@binh-dam-ibigroup binh-dam-ibigroup deleted the tripmon-job-status branch December 11, 2023 20:17
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