Emit a per-node clickhouse_node tag across all node-scoped ClickHouse checks - #24579
Draft
sangeetashivaji wants to merge 2 commits into
Draft
Emit a per-node clickhouse_node tag across all node-scoped ClickHouse checks#24579sangeetashivaji wants to merge 2 commits into
sangeetashivaji wants to merge 2 commits into
Conversation
… checks ClickHouse Cloud billing is moving to per-node, but most check data is aggregated across nodes before it leaves the Agent. This adds a uniform, additive clickhouse_node tag (value = hostName()) to every check that carries node-specific data, so metrics/samples can be sliced per node while database_instance stays cluster-level. - utils: add node_tag() helper (reuses CLUSTER_NODE_TAG) - standard metrics: also tag system.replicas / system.dictionaries per node - query metrics: stop merging rows across nodes; emit one payload per node - query completions / errors / samples: split payloads per node - parts_and_merges / view-refresh gauges: add clickhouse_node alongside existing tags The query-metrics change is breaking: per-query series become per-node and must be re-aggregated across clickhouse_node for cluster totals. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
|
Contributor
Validation ReportAll 21 validations passed. Show details
|
Contributor
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 702090f | Docs | Datadog PR Page | Give us feedback! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds a uniform, additive per-node tag (
clickhouse_node, value = ClickHousehostName()) to every ClickHouse check that carries node-specific data, so metrics/samples/etc. can be sliced (and billed) per node.database_instancestays cluster-level, so existing cluster grouping/filtering is unaffected.Changes by area:
node_tag()helper (reuses the existingCLUSTER_NODE_TAG = 'clickhouse_node').get_queries):system.replicasandsystem.dictionariesare now read viaclusterAllReplicasand tagged per node in single-endpoint mode.system.partsis intentionally left plain — itsGROUP BYis incompatible with thecluster_aware_queryrewrite; per-node parts data comes from the DBM parts/merges check.statements.py): rows are no longer merged across nodes (_merge_rows_across_nodesremoved). Rows are grouped by node and emitted as one payload per node, each carryingclickhouse_node. FQT events are node-tagged too.clickhouse_node.ACTIVE_QUERIES_QUERY/ACTIVE_CONNECTIONS_QUERYnow selecthostName().clickhouse_nodeadded alongside the existingserver_node:/host:tags (kept for backward compatibility).Motivation
ClickHouse Cloud billing is moving to per-node. Today the resource primary key is
database_instance, which is cluster-level, and most check data is aggregated across nodes before it leaves the Agent — so there is no reliable way to attribute metrics to a node. This makes every node-scoped check emit a consistent per-node tag.Breaking behavior: query-metrics per-query series change from cluster-summed to per-node; cluster totals must be re-aggregated across
clickhouse_node. Acceptable while the feature is in preview.Open dependency: the per-node approach emits multiple
database_monitoring_query_metrics/query_activitypayloads for the same(database_instance, timestamp). This assumes the DBM intake does not dedupe on that key — needs confirmation with the dbm-metrics-processor team before merge.Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged