Repository navigation
feat: Add a PromQL backend setting to ClickHouse PromQL sources - #3601
karl-power wants to merge 5 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: f768d99 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
🔴 Tier 4 — CriticalTouches authentication, tenancy data models, the public API or shipped database config — or substantially changes the query rendering engine, background tasks, the OTel pipeline, image build, or release CI. Why this tier:
Review process: Deep review from a domain expert. Synchronous walkthrough may be required. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
PR Review✅ No issues found. |
Deep Review✅ No critical issues found. The PromQL-backend setting, the 5-minute probe cache, the new authenticated endpoint, and the onboarding auto-pin were verified end to end. Auth and team-scoping on 🟡 P2 — recommended
🔵 P3 nitpicks (2)
Reviewers (6): correctness, security, performance, reliability/adversarial (orchestrator-verified), agent-native, learnings-researcher. Testing gaps:
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. How to respond |
E2E Test Results✅ All tests passed • 464 passed • 1 skipped • 1026s
Tests ran across 4 shards in parallel. |
Summary
Stop probing ClickHouse on every PromQL query: a PromQL source can now pin how ClickHouse evaluates it, and the probe answer is kept for 5 minutes when it is not pinned.
promqlBackendsource setting:auto(the default, unchanged behaviour),clickhouse-http(Prometheus HTTP API) ortable-function(prometheusQuery). A pinned source skips the version check and the probe.autokeeps the probe answer per connection for 5 minutes. Inconclusive probes (a timeout, a proxy's 502) are not kept.clickhouse-httpon a server without theprometheus_api_v1handler fails with a clear error instead of a bare 404.promqlBackendis accepted by the MCP save-source tool and the v2 sources API (docs andopenapi.jsonupdated).GET /connections/:id/prometheus-http-apireports whether a connection serves the HTTP API. Onboarding uses it to pin the PromQL source it creates toclickhouse-http, and leaves it on Auto when the answer is no.auto, a kept "yes" can be stale for up to 5 minutes if the handler is removed. The error then points to Auto.openapi.json. Each commit stands alone, so it reads best commit by commit.Screenshots or video
How to reproduce
On
main:db_client_connection_countand press Enter to run it.docker exec -it hdx-dev-<slot>-ch-server-1 clickhouse-clientrunSYSTEM FLUSH LOGSand thenSELECT count() FROM system.query_log WHERE query LIKE 'SELECT version()%' AND query_id LIKE 'hdx-api-%' AND event_time > now() - INTERVAL 1 MINUTE. Re-run the tile with a different time range a few times and repeat. The count grows with every query.On this branch:
hdx-api-version checks appear, and the query log showsWITH prometheus_query_step_%queries.prometheusQueryqueries instead.prometheus_api_v1handler, pin it to "Prometheus HTTP API" and run a tile. The chart shows "This ClickHouse connection does not serve the Prometheus HTTP API…".How to test on Vercel preview
N/A. PromQL queries go through the API, which the Vercel preview (local mode) does not have.
References