Skip to content

[Option 1] Add clickhouse_node tag to query metrics - #24627

Draft
sangeetashivaji wants to merge 2 commits into
masterfrom
sangeeta.shivajirao/add-node-level-data
Draft

[Option 1] Add clickhouse_node tag to query metrics#24627
sangeetashivaji wants to merge 2 commits into
masterfrom
sangeeta.shivajirao/add-node-level-data

Conversation

@sangeetashivaji

@sangeetashivaji sangeetashivaji commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a clickhouse_node tag to ClickHouse DBM query metrics so per-node data can be sliced in-app. Query metrics previously read hostName() as server_node only for per-node checkpointing, then collapsed the node dimension via _merge_rows_across_nodes before emitting.

This change:

  • Preserves the per-(query, node) dimension by carrying server_node on each row and removing the cross-node merge.
  • Groups rows by node and submits one query-metrics payload per node, appending clickhouse_node:<node> to that payload's tags (reusing CLUSTER_NODE_TAG from utils.py, the same key the standard non-DBM metrics already emit).
  • Includes server_node in the FQT row-identity key so the same query on different nodes is tracked distinctly. FQT events themselves are unchanged (node is not a meaningful dimension for the query-text catalog).

This is "Plan 1" (agent-only delivery). A follow-up "Plan 2" will align with the DBM-standard row-field + backend-materialization pattern used by postgres/mysql/sqlserver.

Motivation

The standard (non-DBM) ClickHouse metrics already tag per-node data with clickhouse_node, but the DBM checks do not expose that dimension. This brings the node-level tag to query metrics first, as the initial step of rolling it out across all DBM checks.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add qa/required if this PR needs QA validation, or qa/skip-qa if it does not. Exactly one of the two is required.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

Preserve the per-node dimension in the query-metrics path and emit a
clickhouse_node tag per node, matching the tag the standard (non-DBM)
ClickHouse metrics already use. Rows are kept per-(query, node) and one
metrics payload is submitted per node.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dd-octo-sts

dd-octo-sts Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Validation Report

All 21 validations passed.

Show details
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file
ci Validate CI configuration and code coverage settings
codeowners Validate every integration has a CODEOWNERS entry
config Validate default configuration files against spec.yaml
dep Verify dependency pins are consistent and Agent-compatible
http Validate integrations use the HTTP wrapper correctly
imports Validate check imports do not use deprecated modules
integration-style Validate check code style conventions
jmx-metrics Validate JMX metrics definition files and config
labeler Validate PR labeler config matches integration directories
legacy-signature Validate no integration uses the legacy Agent check signature
license-headers Validate Python files have proper license headers
licenses Validate third-party license attribution list
metadata Validate metadata.csv metric definitions
models Validate configuration data models match spec.yaml
openmetrics Validate OpenMetrics integrations disable the metric limit
package Validate Python package metadata and naming
qa-label Validate the pull request declares whether it needs QA for the next Agent release
readmes Validate README files have required sections
saved-views Validate saved view JSON file structure and fields
version Validate version consistency between package and changelog

View full run

@datadog-prod-us1-4

Copy link
Copy Markdown
Contributor

Tests  Code Coverage

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 95.65%
Overall Coverage: 94.00%

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 6ae55e7 | Docs | Datadog PR Page | Give us feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant