Skip to content

The dashboards are not accurate (Not aligned with the native advanced dashboard) #1784

@iShiBin

Description

@iShiBin

What happened: All the dashboards in the ClickHouse plugin are not aligned with the native dashboards:

  • ClickHouse - Query Analysis
  • ClickHouse - Data Analysis
  • ClickHouse - Cluster Analysis
  • Simple ClickHouse OTel Dashboard
  • Advanced ClickHouse Monitoring Dashboard

The queries of the dashboards in the plugin seems not right. It lacks of the clusterAllReplicas(default, merge('system', '...')) so only shows one replica's metric, and may display a different result if the query run against a different replica.

For example, here is the "ClickHouse - Advanced Monitoring / Queries/second" panel in Grafana.

SELECT toStartOfInterval(event_time, INTERVAL $__interval_s SECOND) AS t, avg(ProfileEvent_Query)
FROM merge('system', '^metric_log')
WHERE $__dateFilter(event_date) AND $__timeFilter(event_time)
GROUP BY t
ORDER BY t WITH FILL STEP $__interval_s

What you expected to happen: The Grafana dashboards should reflect the actual metrics, e.g. the queries should align/reflect the ClickHouse cloud native dashboard.

As a compare, there is the Queries/Second panel in the native advanced dashboard form the ClickHouse cloud console.

WITH toDateTimeOrDefault({from:String}, '', now() - {seconds:UInt32}) AS from,
    toDateTimeOrDefault({to:String}, '', now()) AS to
SELECT
  toStartOfInterval(event_time, INTERVAL {rounding:UInt32} SECOND)::INT AS t,
  avg(metric)
FROM (
  SELECT event_time, sum(ProfileEvent_Query) AS metric
  FROM clusterAllReplicas(default, merge('system', '^metric_log'))
  WHERE event_date BETWEEN toDate(from) AND toDate(to) AND event_time BETWEEN from AND to
  GROUP BY event_time
)
GROUP BY t
ORDER BY t WITH FILL STEP {rounding:UInt32} SETTINGS skip_unavailable_shards = 1

How to reproduce it (as minimally and precisely as possible):
Add a ClickHouse datasource in Grafana, and import the dashboards.

Screenshots

Image Image

Anything else we need to know?:

Environment:

  • Grafana version: 13.1.0
  • Plugin version: 4.15.0 (The current latest version)
  • OS Grafana is installed on:
  • User OS & Browser: MacOS Chrome 147.0.7727.56
  • Others:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Incoming

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions