Skip to content

Conversation

@ZanCorDX
Copy link
Collaborator

πŸ“ Summary

Brought clickhouse robust saving (with local copy) from orderflow proxy repo (flashbots/buildernet-orderflow-proxy-v2.git)

πŸ’‘ Motivation and Context

Code reuse


βœ… I have completed the following steps:

  • Run make lint
  • Run make test
  • Added tests (if applicable)

@ZanCorDX ZanCorDX requested a review from dvush as a code owner October 23, 2025 12:33
@ZanCorDX ZanCorDX marked this pull request as draft October 23, 2025 12:34
Copy link
Contributor

@thedevbirb thedevbirb left a comment

Choose a reason for hiding this comment

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

First pass!

/// Whether to use only the in-memory backup (for testing purposes).
#[cfg(test)]
use_only_memory_backup: bool,
_metrics_phantom: std::marker::PhantomData<MetricsType>,
Copy link
Contributor

@thedevbirb thedevbirb Oct 23, 2025

Choose a reason for hiding this comment

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

Interesting, how are you planning to use this? I mean the Metrics trait and the marker here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this inside a metrics folder? This is more time-related utilities.

Copy link
Contributor

Choose a reason for hiding this comment

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

What's the rationale for distinguish clickhouse and clickhouse_with_backup? Eventually, I get it could make sense to have a backup subfolder of clickhouse.

Copy link
Contributor

Choose a reason for hiding this comment

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

In orderflow proxy v2, this has been extracted from reth_tasks so that the project didn't have reth dependencies (at least directly). However, rbuilder heavily depends on reth already. As such, I'd suggest you to import reth_tasks in this project and use that instead. Then, you can delete this folder entirely.

Copy link
Contributor

Choose a reason for hiding this comment

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

In more detail, rbuilder should re-export reth_tasks so that orderflow proxy v2 can use it, so there is no need to need to add it again as a dependency.

Copy link
Contributor

@thedevbirb thedevbirb left a comment

Choose a reason for hiding this comment

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

Second pass

Comment on lines 5 to 17
pub trait Metrics {
fn increment_write_failures(err: String);
fn process_quantities(quantities: &Quantities);
fn record_batch_commit_time(duration: Duration);
fn increment_commit_failures(err: String);
fn set_queue_size(size: usize, order: &'static str);
fn set_disk_backup_size(size_bytes: u64, batches: usize, order: &'static str);
fn increment_backup_disk_errors(order: &'static str, error: &str);
fn set_memory_backup_size(size_bytes: u64, batches: usize, order: &'static str);
fn process_backup_data_lost_quantities(quantities: &Quantities);
fn process_backup_data_quantities(quantities: &Quantities);
fn set_backup_empty_size(order: &'static str);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You can expose a NoOp struct here with default implementation. Also another nit/question, do you explicitly want to not provide a default, empty implementation?

Copy link
Contributor

Choose a reason for hiding this comment

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

In more detail, rbuilder should re-export reth_tasks so that orderflow proxy v2 can use it, so there is no need to need to add it again as a dependency.

@ZanCorDX ZanCorDX marked this pull request as ready for review October 24, 2025 18:07
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.

2 participants