ClickHouse / ClickHouse/clickhouse-rs

Expose Inserter metrics / debug info for performance monitoring

Open
#348 3 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
559
Forks
172
Avg merge
1d 19h
Merged PRs (30d)
3

Description

### Use case
Now, `clickhouse.Inserter` like `black box` - it's hard to see what's happening with performance

I want to be able to:
- monitor how many rows `Inserter` actually has buffered at any moment.
- *when* and *why* a flush is triggered (manual `commit()`, `with_period()`, `with_max_rows()`, etc.).
- see the size of each batch of data actually sent to ClickHouse.
- measure the local-to-server round-trip time per flush (commit RTT).
- track total rows sent and batches committed over time.

### Describe the solution you'd like

expose client-side flush/debug metrics in prometheus format like:

- buffered_rows / buffered_bytes
- total_rows_sent / total_batches
- last_batch_rows / last_batch_bytes
- last_batch_rtt_seconds
- last_flush_reason

### Describe the alternatives you've considered

add inserter function:
- buffered_rows() → current buffered row count
- buffered_bytes() → estimated serialized size in bytes
- on_flush(callback: Fn(&FlushInfo)) → hook fired before/after every flush
- with_debug_logging(enabled: bool) → enable structured debug logs for Inserter

### Additional context

Contributor guide

Open the contributing guide

Research direction

Start by locating clickhouse.Inserter and reviewing how buffering and flushes currently work. Clarify the metrics API, flush-reason semantics, and Prometheus format before implementation; done should include agreed metrics for buffering, batches, rows, RTT, and flush reasons.

Written by the indexing model from the issue text.

Assessment

Tech stack
clickhouse, rust
Domain
databases, observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.