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

chore(workflows): move wf gc and metrics publish into worker #1943

Open
wants to merge 1 commit into
base: 01-25-chore_restructure_server_binaries
Choose a base branch
from

Conversation

MasterPtato
Copy link
Contributor

Changes

Copy link
Contributor Author

MasterPtato commented Jan 27, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

cloudflare-workers-and-pages bot commented Jan 27, 2025

Deploying rivet with  Cloudflare Pages  Cloudflare Pages

Latest commit: ca16fe8
Status: ✅  Deploy successful!
Preview URL: https://80916e2a.rivet.pages.dev
Branch Preview URL: https://01-27-chore-workflows-move-w.rivet.pages.dev

View logs

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR consolidates workflow management by moving garbage collection and metrics publishing into the worker context. Here's a summary of the key changes:

  • Moves workflow garbage collection and metrics publishing from standalone services into the Worker module with new gc() and publish_metrics() functions
  • Adds new key types LastPingTsKey and MetricsLockKey for tracking worker instance health and coordinating metrics collection
  • Implements clear_expired_leases() and publish_metrics() in database adapters (CrdbNats and FdbSqliteNats) to handle workflow failover and metrics
  • Replaces WORKER_ACTIVE metric with more granular WORKER_LAST_PING metric that tracks individual worker instance health
  • Removes standalone services and their configurations from edge-server and server run configs, consolidating functionality into the worker

The changes improve the architecture by centralizing workflow management functionality and providing better worker health tracking, though the removal of integration tests should be addressed.

19 file(s) reviewed, 8 comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

Choose a reason for hiding this comment

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

style: The old code used a 60 second operation timeout (Duration::from_secs(60)), but there's no explicit timeout in the new worker GC implementation. Consider adding a timeout to prevent long-running GC operations from blocking the worker.

@MasterPtato MasterPtato force-pushed the 01-27-chore_workflows_move_wf_gc_and_metrics_publish_into_worker branch from bee5d38 to df8b94d Compare January 27, 2025 22:17
@MasterPtato MasterPtato changed the base branch from 01-25-feat_pb_ds__move_to_edge to 01-25-chore_restructure_server_binaries January 27, 2025 22:17
@MasterPtato MasterPtato force-pushed the 01-25-chore_restructure_server_binaries branch from e4b3b80 to 541aa12 Compare January 28, 2025 01:43
@MasterPtato MasterPtato force-pushed the 01-27-chore_workflows_move_wf_gc_and_metrics_publish_into_worker branch from df8b94d to f6f8a7b Compare January 28, 2025 01:43
@MasterPtato MasterPtato force-pushed the 01-25-chore_restructure_server_binaries branch from 541aa12 to 9b0bc5b Compare February 1, 2025 02:41
@MasterPtato MasterPtato force-pushed the 01-27-chore_workflows_move_wf_gc_and_metrics_publish_into_worker branch from f6f8a7b to d7a614b Compare February 1, 2025 02:41
@MasterPtato MasterPtato force-pushed the 01-25-chore_restructure_server_binaries branch from 9b0bc5b to 0e34b51 Compare February 1, 2025 02:44
@MasterPtato MasterPtato force-pushed the 01-27-chore_workflows_move_wf_gc_and_metrics_publish_into_worker branch from d7a614b to cbfb3c8 Compare February 1, 2025 02:44
@MasterPtato MasterPtato force-pushed the 01-25-chore_restructure_server_binaries branch from 0e34b51 to f436af7 Compare February 3, 2025 19:19
@MasterPtato MasterPtato force-pushed the 01-27-chore_workflows_move_wf_gc_and_metrics_publish_into_worker branch from cbfb3c8 to f993bd7 Compare February 3, 2025 19:19
@MasterPtato MasterPtato force-pushed the 01-25-chore_restructure_server_binaries branch from f436af7 to c8701a1 Compare February 4, 2025 00:47
@MasterPtato MasterPtato force-pushed the 01-27-chore_workflows_move_wf_gc_and_metrics_publish_into_worker branch from f993bd7 to ca16fe8 Compare February 4, 2025 00:47
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.

1 participant