Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 61 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ default = []
server = ["dep:axum", "dep:tower-http", "dep:tokio", "dep:tokio-util", "dep:prometheus"]
loadtest = ["ureq"]
replay = ["ureq"]
pg-sync = ["dep:sqlx", "dep:clap", "dep:reqwest", "dep:chrono", "dep:tokio", "dep:axum", "dep:tower-http", "dep:futures-core", "dep:futures-util", "dep:bytes"]
pg-sync = ["dep:sqlx", "dep:clap", "dep:reqwest", "dep:chrono", "dep:tokio", "dep:axum", "dep:tower-http", "dep:futures-core", "dep:futures-util", "dep:bytes", "dep:serde_yaml"]
simd = ["roaring/simd"]
heap-prof = ["dep:tikv-jemallocator", "dep:tikv-jemalloc-ctl"]
serde_yaml = ["dep:serde_yaml"]

[dependencies]
# Bitmap indexes
Expand Down Expand Up @@ -85,6 +86,7 @@ thiserror = "2"
# Logging
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
serde_yaml = { version = "0.9.34", optional = true }

[dev-dependencies]
# Property-based testing
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
pub mod bitmap_fs;
pub mod bound_store;
pub mod bucket_diff_log;
#[cfg(feature = "pg-sync")]
pub mod ops_processor;
#[cfg(feature = "pg-sync")]
pub mod ops_wal;
pub mod cache;
pub mod capture;
pub mod concurrency;
Expand Down
39 changes: 39 additions & 0 deletions src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ pub struct Metrics {
pub pgsync_cycle_seconds: HistogramVec,
pub pgsync_rows_fetched_total: IntCounterVec,
pub pgsync_cursor_position: IntGaugeVec,

// V2 sync metrics (unified namespace with source label)
pub sync_cursor_position: IntGaugeVec,
pub sync_max_id: IntGaugeVec,
pub sync_lag_rows: IntGaugeVec,
pub sync_ops_total: IntCounterVec,
pub sync_wal_bytes: IntGaugeVec,
}

impl Metrics {
Expand Down Expand Up @@ -570,6 +577,28 @@ impl Metrics {
)
.unwrap();

// V2 sync metrics (unified namespace)
let sync_cursor_position = IntGaugeVec::new(
Opts::new("bitdex_sync_cursor_position", "Current sync cursor position"),
&["source"],
).unwrap();
let sync_max_id = IntGaugeVec::new(
Opts::new("bitdex_sync_max_id", "Max ops table ID (for lag calculation)"),
&["source"],
).unwrap();
let sync_lag_rows = IntGaugeVec::new(
Opts::new("bitdex_sync_lag_rows", "Number of ops rows behind"),
&["source"],
).unwrap();
let sync_ops_total = IntCounterVec::new(
Opts::new("bitdex_sync_ops_total", "Total ops received from sync sources"),
&["source"],
).unwrap();
let sync_wal_bytes = IntGaugeVec::new(
Opts::new("bitdex_sync_wal_bytes", "Current WAL file size in bytes"),
&["source"],
).unwrap();

// Register all metrics
registry.register(Box::new(alive_documents.clone())).unwrap();
registry.register(Box::new(slot_high_water.clone())).unwrap();
Expand Down Expand Up @@ -671,6 +700,11 @@ impl Metrics {
registry.register(Box::new(pgsync_cycle_seconds.clone())).unwrap();
registry.register(Box::new(pgsync_rows_fetched_total.clone())).unwrap();
registry.register(Box::new(pgsync_cursor_position.clone())).unwrap();
registry.register(Box::new(sync_cursor_position.clone())).unwrap();
registry.register(Box::new(sync_max_id.clone())).unwrap();
registry.register(Box::new(sync_lag_rows.clone())).unwrap();
registry.register(Box::new(sync_ops_total.clone())).unwrap();
registry.register(Box::new(sync_wal_bytes.clone())).unwrap();

Self {
registry,
Expand Down Expand Up @@ -746,6 +780,11 @@ impl Metrics {
pgsync_cycle_seconds,
pgsync_rows_fetched_total,
pgsync_cursor_position,
sync_cursor_position,
sync_max_id,
sync_lag_rows,
sync_ops_total,
sync_wal_bytes,
}
}

Expand Down
Loading
Loading