Skip to content

Expose Inserter metrics / debug info for performance monitoring #348

@tomatopunk

Description

@tomatopunk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions