Skip to content

Feature request: Add CRD field to enable ClickHouse Prometheus metrics endpoint #42

@sunilhonest

Description

@sunilhonest

Summary

ClickHouse natively supports exposing Prometheus metrics via a <prometheus> configuration block in config.xml:

<prometheus>
    <port>9363</port>
    <endpoint>/metrics</endpoint>
    <metrics>true</metrics>
    <asynchronous_metrics>true</asynchronous_metrics>
    <events>true</events>
    <errors>true</errors>
</prometheus>

Currently, the operator generates config.xml for ClickHouse without this block, and there is no CRD field to enable it. This means users who want to monitor ClickHouse with an existing Prometheus instance must deploy a separate exporter.

Proposal

Add a CRD field under spec.clickhouse to enable the built-in Prometheus metrics endpoint, e.g.:

spec:
  clickhouse:
    prometheus:
      enabled: true
      port: 9363        # optional, default 9363
      endpoint: /metrics # optional, default /metrics

When enabled, the operator would:

  1. Inject the <prometheus> block into the generated config.xml
  2. Add port 9363 to the ClickHouse container and Service definitions

This would allow users to scrape ClickHouse metrics (system.metrics, system.events, system.asynchronous_metrics, etc.) directly using an existing Prometheus instance without needing a separate exporter deployment.

Use Case

We run Coroot alongside an existing Prometheus instance (kube-prometheus-stack) and want to monitor ClickHouse health (query performance, memory usage, replication lag, disk usage, etc.) via ServiceMonitor/PodMonitor without deploying additional components.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions