Repository navigation
fix: resolve PromQL queries through their source - #3372
Conversation
Backport of the non-RBAC part of the EE change that moved the PromQL API from connectionId to sourceId. The connection and TimeSeries table now always come from the PromQL source; caller-supplied database/table are ignored for ClickHouse and not forwarded to external Prometheus. Saved PromQL chart configs require source and no longer persist connection.
🦋 Changeset detectedLatest commit: d1ff56a 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
Duplicate code analysis3 new clones introduced by this PR.
If one of these duplicates a helper that already exists, import it instead jscpd compared this branch against |
E2E Test Results✅ All tests passed • 413 passed • 1 skipped • 1454s
Tests ran across 4 shards in parallel. |
|
PR Review
3 finding(s): 🔴 0 critical · 🟠 1 major · 🔵 2 minor 2 posted as inline comment(s) on the changed lines. 1 listed below. Findings outside the changed lines1 minor
Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
Deep ReviewScope: PromQL API reroutes queries through a Intent: Backport of a reviewed enterprise change, minus the source-RBAC layer. Callers name a PromQL source; the server reads connection and table from it so a request can only reach data through a source. ✅ No critical (P0/P1) issues found. Security scoping is intact — 🟡 P2 — recommended
🔵 P3 nitpicks (5)
Agent-native note: Reviewers (6): security, previous-comments, project-standards, kieran-typescript, maintainability, learnings-researcher (plus orchestrator verification of the backward-compat save path, cross-team scoping, and the result discriminator). Testing gaps:
Coverage note: The correctness, adversarial, api-contract, testing, and agent-native reviewers did not return before synthesis was required; the correctness/adversarial/api-contract territory (backward-compat save mechanism, discriminator soundness, scoping) was verified directly by the orchestrator and is reflected above. The 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 |
PromQL lookups are now keyed by source ID alone, so editing a source's table left the old table's values cached. Also drop the banner comment in the prometheus router.
e14cd2b to
5eb60be
Compare
Summary
PromQL API requests now name a PromQL source (
sourceId) instead of a connection and table; the server reads both from the source./api/v1/prometheus/*routes takesourceIdinstead ofconnectionId(400 if missing; 404 if the source doesn't exist, isn't PromQL, or its connection is gone)database/tableare ignored for ClickHouse and not forwarded to external Prometheus endpointssourceand no longer persistconnection, which is filled from the source at query time. Existing tiles with a storedconnectionstill loadsourceIdfrom charts, autocomplete, and PromQL label dashboard filtersrunSavedChartConfigrejects PromQL tiles explicitlysourceId, and provisioned dashboard PromQL tiles must setsourceContext
Backport of an already-reviewed enterprise change that adds source RBAC to the PromQL API, minus the RBAC parts (route role checks, source access rules, and their tests). Also omitted: the enterprise PromQL feature-check middleware (here the router is only mounted when
ENABLE_PROMQL=true) and an MCP notebook fix (no notebooks here).How to test on Vercel preview
References
Related PRs: https://github.com/DeploySentinel/hyperdx-ee/pull/3614