Skip to content

[HDX-5759] Add PromQL support behind hyperdx.promql.enabled - #326

Merged
jordan-simonovski merged 3 commits into
mainfrom
karl/hdx-5759-promql
Nov 18, 2026
Merged

jordan-simonovski merged 3 commits into
mainfrom
karl/hdx-5759-promql

Conversation

@karl-power

Copy link
Copy Markdown
Contributor

[HDX-5759] Add PromQL support behind hyperdx.promql.enabled

Adds a hyperdx.promql.enabled toggle (on by default) that enables PromQL end to end: HyperDX feature flags, a PromQL default source, and the ClickHouse config the TimeSeries engine and Prometheus endpoints need.

  • Add hyperdx.promql.enabled: true and derive ENABLE_PROMQL / NEXT_PUBLIC_ENABLE_PROMQL from it in hyperdx.config.
  • Add a PromQL entry to hyperdx.deployment.defaultSources on default.metrics_ts. HyperDX only seeds promql sources when ENABLE_PROMQL is true, so the entry is inert when the toggle is off.
  • Inject ClickHouse settings into the ClickHouseCluster CR when the toggle is on and the server image tag is 26.6 or newer: Prometheus metrics/write/read handlers on the metrics port, a prometheus_api_v1 handler on /prometheus/api/v1, and allow_experimental_time_series_table: 1 on the default profile. User values under settings.extraConfig / extraUsersConfig win over the injected ones.
  • Grant the app user CREATE TEMPORARY TABLE ON *.*. The prometheus_api_v1 handler reads through the timeSeriesSelector() table function and ClickHouse gates all table functions behind that privilege (src/TableFunctions/ITableFunction.cpp, checkCreateTemporaryTableAccess).
  • Version gate reduces four-part ClickHouse tags and -alpine style suffixes to semver; a tag with no version (e.g. latest) is treated as new enough.
  • Changeset (minor) and docs/UPGRADE.md note: ClickHouse pods restart once; users pinning ClickHouse < 26.6 should set hyperdx.promql.enabled: false.

Testing

  • make test (316 unit tests), make coverage (99.86% line / 90.44% branch), make docs.
  • Kind cluster with the operators chart and this chart installed:
    • ClickHouseCluster reconciles to Ready with the injected config.
    • /metrics returns 200, /write and /read exist on 9363 (415/500 on empty bodies, not 404).
    • GET /prometheus/api/v1/query?query=up&database=default&table=metrics_ts returns {"status":"success"} as the app user.
    • Collector creates metrics_ts with ENGINE = TimeSeries; after a team exists HyperDX pushes a prometheusremotewrite exporter to the collector. An OTLP gauge sent to the collector was queried back via PromQL.
    • With hyperdx.promql.enabled=false or tag 25.7-alpine, the CR carries no PromQL settings.

References

@changeset-bot

changeset-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c9d3705

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
helm-charts Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@karl-power
karl-power marked this pull request as ready for review November 18, 2026 10:20
@karl-power
karl-power requested a review from a team as a code owner November 18, 2026 10:20
@karl-power
karl-power force-pushed the karl/hdx-5759-promql branch 2 times, most recently from d719595 to 6a3bb51 Compare November 18, 2026 10:21
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Helm template coverage

Metric Value
Line coverage 99.86%
Branch coverage 90.91%
Line threshold 99% (met)
Branch threshold 90% (met)
Uncovered details

charts/clickstack/templates/NOTES.txt

Uncovered lines: none

Uncovered branches: 37:default:fallback

charts/clickstack/templates/_helpers.tpl

Uncovered lines: 17

Uncovered branches: 130:range:empty, 132:range:empty, 133:ternary:false, 16:if:true, 194:or(1):true, 211:range:empty, 242:default:fallback, 243:or(1):true, 259:if:false, 389:range:empty, 410:range:empty

charts/clickstack/templates/additional-manifests.yaml

Uncovered lines: none

Uncovered branches: none

charts/clickstack/templates/clickhouse/cluster.yaml

Uncovered lines: none

Uncovered branches: none

charts/clickstack/templates/clickhouse/keeper.yaml

Uncovered lines: none

Uncovered branches: none

charts/clickstack/templates/hyperdx/configmap.yaml

Uncovered lines: none

Uncovered branches: none

charts/clickstack/templates/hyperdx/cronjob-check-alerts.yaml

Uncovered lines: none

Uncovered branches: none

charts/clickstack/templates/hyperdx/dashboard-configmap.yaml

Uncovered lines: none

Uncovered branches: none

charts/clickstack/templates/hyperdx/dashboard-provisioner-rbac.yaml

Uncovered lines: none

Uncovered branches: 40:range:empty

charts/clickstack/templates/hyperdx/deployment.yaml

Uncovered lines: none

Uncovered branches: 121:default:fallback, 131:default:fallback, 196:default:fallback, 201:with:empty, 20:with:empty, 25:if:false, 26:default:fallback, 41:if:false, 42:with:empty

charts/clickstack/templates/hyperdx/hpa.yaml

Uncovered lines: none

Uncovered branches: 16:with:empty

charts/clickstack/templates/hyperdx/ingress.yaml

Uncovered lines: none

Uncovered branches: 15:with:empty, 35:if:false, 40:range:empty, 45:range:empty, 48:with:empty, 54:range:empty, 58:range:empty, 59:or(2):true, 59:or(3):true

charts/clickstack/templates/hyperdx/networkpolicy.yaml

Uncovered lines: none

Uncovered branches: 11:with:empty

charts/clickstack/templates/hyperdx/pdb.yaml

Uncovered lines: none

Uncovered branches: 10:with:empty

charts/clickstack/templates/hyperdx/secret.yaml

Uncovered lines: none

Uncovered branches: 1:or(2):true, 1:or(3):true

charts/clickstack/templates/hyperdx/service.yaml

Uncovered lines: none

Uncovered branches: 14:default:fallback, 9:with:empty

charts/clickstack/templates/hyperdx/serviceaccount.yaml

Uncovered lines: none

Uncovered branches: none

charts/clickstack/templates/mongodb/community.yaml

Uncovered lines: none

Uncovered branches: none

charts/clickstack/templates/mongodb/password-secret.yaml

Uncovered lines: none

Uncovered branches: none

charts/clickstack/templates/otel-collector/custom-config.yaml

Uncovered lines: none

Uncovered branches: none

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

PromQL behind hyperdx.promql.enabled is a tightly-scoped, well-tested change. The version gate (regexFind → semverCompare ">= 26.6") is exercised across 2-/4-part/latest/null tags; the mergeOverwrite injection correctly lets user settings win and uses deepCopy so global .Values is not mutated; the new clickstack.clickhouse.* named templates follow convention; and the changeset, docs/UPGRADE.md note, and regenerated README are all consistent. No render-breaking, auth-bypass, or data-loss issue was found in this diff.

✅ No critical issues found.

🟡 P2 — recommended

  • charts/clickstack/values.yaml:307 — the PromQL default source hardcodes "databaseName": "default", but the injected remote_write/remote_read handlers derive their database from HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE (_helpers.tpl:340); overriding that value points the handlers at a non-default database while the HyperDX PromQL source still queries default.metrics_ts, silently returning no data.
    • Fix: template the PromQL source's databaseName from HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE, or document that PromQL only supports the default database.
    • maintainability, correctness

Reviewers (6): correctness, testing, maintainability, project-standards, security, adversarial.

Testing gaps:

  • No helm-unittest asserts the PromQL default source databaseName tracks a non-default HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE, so the handler/source database mismatch above would go uncaught by the suite.

No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR.

@jordan-simonovski
jordan-simonovski enabled auto-merge (squash) November 18, 2026 11:33
@jordan-simonovski
jordan-simonovski merged commit 3827716 into main Nov 18, 2026
10 checks passed
@jordan-simonovski
jordan-simonovski deleted the karl/hdx-5759-promql branch November 18, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants