Skip to content

feat: per-database write rates in status#90

Merged
jxom merged 1 commit intomainfrom
feat/per-db-write-rates
Feb 25, 2026
Merged

feat: per-database write rates in status#90
jxom merged 1 commit intomainfrom
feat/per-db-write-rates

Conversation

@jxom
Copy link
Copy Markdown
Member

@jxom jxom commented Feb 25, 2026

Adds per-sink write rate tracking (blocks/sec) so you can see how fast PostgreSQL and ClickHouse are each being populated.

Changes

  • metrics.rs — Rolling rate tracker (3s window) with update_sink_block_rate / get_sink_block_rate
  • writer.rs — Instrumented all 4 PG write functions with sink metrics (duration, rows, rate)
  • ch_sink.rs — Added rate tracking to CH block writes
  • service/mod.rs — Added rate: Option<f64> to StoreStatus
  • api/mod.rs — Populates rate in /status response for both stores
  • cli/status.rs — Shows rate inline: PostgreSQL (2500 blk/s) in all display modes

Example output

│  PostgreSQL (2500 blk/s)
│  ├─ blocks     1,234,567 ✓
│  ├─ txs        5,678,901 ✓
│  ├─ logs       12,345,678 ✓
│  └─ receipts   5,678,901 ✓
│
│  ClickHouse (1800 blk/s)
│  ├─ blocks     1,000,000 / 1,234,567 (81%)
│  ...

Add a rolling rate tracker (3s window) that measures blocks/sec for each
sink independently. Both PostgreSQL and ClickHouse writers now update
the tracker on every block write.

- Add SinkRateTracker to metrics.rs with update/get functions
- Instrument PG writer with sink write duration/rows/rate metrics
- Add rate field to StoreStatus (blocks/sec, optional)
- Wire rates into /status API response and CLI display
- Show rate inline: 'PostgreSQL (2500 blk/s)' when actively writing

Amp-Thread-ID: https://ampcode.com/threads/T-019c928a-5ea3-72ac-9724-a96ae0d27fd1
Co-authored-by: Amp <amp@ampcode.com>
@jxom jxom force-pushed the feat/per-db-write-rates branch from 4760810 to d040653 Compare February 25, 2026 02:13
@jxom jxom merged commit c9807cc into main Feb 25, 2026
@jxom jxom deleted the feat/per-db-write-rates branch February 25, 2026 02:13
o-az pushed a commit that referenced this pull request Apr 27, 2026
Add a rolling rate tracker (3s window) that measures blocks/sec for each
sink independently. Both PostgreSQL and ClickHouse writers now update
the tracker on every block write.

- Add SinkRateTracker to metrics.rs with update/get functions
- Instrument PG writer with sink write duration/rows/rate metrics
- Add rate field to StoreStatus (blocks/sec, optional)
- Wire rates into /status API response and CLI display
- Show rate inline: 'PostgreSQL (2500 blk/s)' when actively writing

Amp-Thread-ID: https://ampcode.com/threads/T-019c928a-5ea3-72ac-9724-a96ae0d27fd1

Co-authored-by: Amp <amp@ampcode.com>
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