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

feat(workflows): implement metrics for fdb driver #2057

Open
wants to merge 1 commit into
base: 02-20-fix_move_actor_state_to_fdb
Choose a base branch
from

Conversation

MasterPtato
Copy link
Contributor

Changes

Copy link

cloudflare-workers-and-pages bot commented Feb 20, 2025

Deploying rivet with  Cloudflare Pages  Cloudflare Pages

Latest commit: c5b7bb3
Status:🚫  Build failed.

View logs

Copy link
Contributor Author

MasterPtato commented Feb 20, 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.

@NathanFlurry NathanFlurry force-pushed the 02-20-feat_workflows_implement_metrics_for_fdb_driver branch from c521a04 to 729d516 Compare February 20, 2025 03:50
@NathanFlurry NathanFlurry force-pushed the 02-20-fix_move_actor_state_to_fdb branch from 8412313 to 1b5874e Compare February 20, 2025 03:50
@NathanFlurry NathanFlurry marked this pull request as ready for review February 20, 2025 08:02
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 implements metrics collection for the FDB (FoundationDB) driver in the workflow system, focusing on workflow state tracking and performance monitoring. Here's a concise summary of the key changes:

  • Added DataSubspaceKey and workflow state tracking structures to monitor workflow lifecycle states (Complete, Running, Sleeping, Dead)
  • Implemented metrics collection in publish_metrics() to track total, active, dead, and sleeping workflows with proper reset functionality
  • Made PendingSignalSubspaceKey::new() public and improved key handling for better metrics access
  • Added workflow state detection based on workflow keys and improved error handling for metrics collection
  • Implemented proper locking mechanism for metrics publishing to prevent concurrent updates

The changes provide a robust foundation for monitoring workflow performance and state transitions in the FDB driver.

4 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +424 to +441
} else if let WorkflowState::Dead = current_state {
if let Ok(_) = self
.subspace
.unpack::<keys::workflow::OutputChunkKey>(entry.key())
{
current_state = WorkflowState::Complete;
} else if let Ok(_) = self
.subspace
.unpack::<keys::workflow::WorkerInstanceIdKey>(entry.key())
{
current_state = WorkflowState::Running;
} else if let Ok(_) = self
.subspace
.unpack::<keys::workflow::HasWakeConditionKey>(entry.key())
{
current_state = WorkflowState::Sleeping;
}
}
Copy link

Choose a reason for hiding this comment

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

logic: State transition logic doesn't handle the case where multiple state indicators exist simultaneously - could lead to incorrect metrics

@NathanFlurry NathanFlurry changed the base branch from 02-20-fix_move_actor_state_to_fdb to graphite-base/2057 February 20, 2025 21:34
@MasterPtato MasterPtato force-pushed the 02-20-feat_workflows_implement_metrics_for_fdb_driver branch from 729d516 to c5b7bb3 Compare February 20, 2025 22:02
@MasterPtato MasterPtato changed the base branch from graphite-base/2057 to 02-20-fix_move_actor_state_to_fdb February 21, 2025 02:27
@NathanFlurry NathanFlurry force-pushed the 02-20-feat_workflows_implement_metrics_for_fdb_driver branch from c5b7bb3 to 729d516 Compare February 21, 2025 05:17
@NathanFlurry NathanFlurry force-pushed the 02-20-fix_move_actor_state_to_fdb branch from 4b4e6ae to 1b5874e Compare February 21, 2025 05:17
Copy link

Deploying rivet-hub with  Cloudflare Pages  Cloudflare Pages

Latest commit: 729d516
Status:⚡️  Build in progress...

View logs

Copy link

Deploying rivet with  Cloudflare Pages  Cloudflare Pages

Latest commit: 729d516
Status:🚫  Build failed.

View logs

Copy link

Deploying rivet-hub with  Cloudflare Pages  Cloudflare Pages

Latest commit: 729d516
Status: ✅  Deploy successful!
Preview URL: https://64a6d5ba.rivet-hub-7jb.pages.dev
Branch Preview URL: https://02-20-feat-workflows-impleme.rivet-hub-7jb.pages.dev

View logs

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