Skip to content

[CON-151] Refactor snapback into monitoring queue - #3142

Merged
theoilie merged 9 commits into
masterfrom
theo-refactor-snapback-queues
May 25, 2022
Merged

theoilie merged 9 commits into
masterfrom
theo-refactor-snapback-queues

Conversation

@theoilie

@theoilie theoilie commented May 24, 2022 •

Copy link
Copy Markdown
Contributor

Description

  • Made new StateMonitoringQueue and StateReconciliationQueue classes
    • Only StateMonitoringQueue is implemented so I can get feedback before doing something similar for StateReconciliationQueue
    • Add queue to service registry and bull-board
    • Rate limit the queue to a default of 1 job per minute to avoid spamming other nodes with requests. New config options (exposed in health check):
      • stateMonitoringQueueRateLimitInterval: interval (ms) during which at most stateMonitoringQueueRateLimitJobsPerInterval jobs will run
      • stateMonitoringQueueRateLimitJobsPerInterval: number of state monitoring jobs that can run in each interval (0 to pause queue)
  • Refactored the data-gathering part of processStateMachineOperation into its own file
    • Only using functions (no class variables) and new job data (jobs also return their results so bull-board gives more info
    • Made logs more searchable (removed characters like colon, equals, and parenthesis because loggly doesn't seem to be able to escape them)
  • Extracted parts of snapback and peerSetManager into various stateless modules (nodeHealthManager.js, nodeToSpIdManager.js, utils.js, monitoring/utils.js, and clockUtils.js)
  • Move the functionality that updates the list of Service Providers to its own top-level call so we don't query that endpoint on each run. This should be moved to its own cron/queue later

Tests

  • Verified local logs and bull-board job data/results -- rate limiting is working at 1 job per minute
  • Added tests for StateMonitoringQueue
  • This will need more tests. Most core functions are copy/pasted from snapback with minor edits, so they were mostly tested before but need coverage in their new context

How will this change be monitored? Are there sufficient logs?

  • Search logs for StateMonitoringQueue
  • Verify that the monitoring jobs are running on bull-board (/health/bull/ endpoint) at 1 job per minute, and inspect their data. Jobs now take data as input and output their results, so they can be more easily debugged from bull-board without combing logs
    • Compare the output of jobs in the new monitoring queue with the output of steps for jobs from the existing snapback (state-machine) queue. The results of each step in the decision tree should be the same
  • Look through logs containing processStateMonitoringJob if necessary. This is the new equivalent of processStateMachineOperation

@theoilie
theoilie requested a review from SidSethi May 24, 2022 02:16
currentModuloSlice
}
try {
// TODO: Wire up metrics

ghost May 24, 2022 •

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.

will wire this up for its own health check later if desired. there can be separate checks for monitoring and reconciliation queues

ghost 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.

submitting what i have so far lol, so much code! still going through

Comment thread creator-node/src/serviceRegistry.js Resolved
@SidSethi
SidSethi self-requested a review May 24, 2022 21:40
- Remove startTime (it's not used, and Bull already tells us the start time)
- Move RECONFIG_MODES to constants
- Rename nodeToSpId to cNodeToSpIdMap
Theo Ilie added 3 commits May 25, 2022 16:47
- Separate business logic from event registration
- Consolidate clockUtils into utils
- Make util export functions instead of using class

ghost 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.

incredible - only ask is to change default values to 0 for now

Comment thread creator-node/src/config.js Resolved
@theoilie
theoilie merged commit 27ccd72 into master May 25, 2022
@theoilie
theoilie deleted the theo-refactor-snapback-queues branch May 25, 2022 21:49
@theoilie theoilie changed the title Refactor snapback into monitoring queue [CON-151] Refactor snapback into monitoring queue May 26, 2022
@AudiusProject AudiusProject deleted a comment from linear Bot Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants