Skip to content

feat: Support series limit on PromQL time charts - #3294

Merged
kodiakhq[bot] merged 2 commits into
mainfrom
hdx-4900-support-series-limit-for-promql-charts
Oct 6, 2026
Merged

kodiakhq[bot] merged 2 commits into
mainfrom
hdx-4900-support-series-limit-for-promql-charts

Conversation

@karl-power

Copy link
Copy Markdown
Contributor

Summary

Adds Series Limit to PromQL line and stacked bar charts. These charts already cap rendered series in the browser (default 250, with "load all"), but the setting was hidden in Display Settings and dropped on save because both PromQL pick lists in ChartEditor/utils.ts omitted seriesLimit.

  • Show Series Limit in the drawer for PromQL time charts, and persist it.
  • The cap is client-side, like raw SQL. Prometheus's limit keeps an arbitrary label-sorted subset, not the top N by value, and the ClickHouse table-function fallback ignores it.
  • HiddenSeriesIndicator gets an optional reduceCardinalityHint, so PromQL charts suggest narrowing label matchers or sum by (...) instead of GROUP BY / WHERE.

How to test on Vercel preview

Plot a PromQL line chart over 30 series, set Series Limit to 3 in Display Settings, and confirm 3 series are shown with a warning icon that loads the rest on click. Save the tile, reload, and confirm the limit persists.

References

  • Linear Issue: Closes HDX-4900

@vercel

vercel Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hyperdx-oss Ready Ready Preview Oct 6, 2026 1:57pm UTC
hyperdx-storybook Ready Ready Preview Oct 6, 2026 1:57pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9506452

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

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Patch
@hyperdx/api Patch
@hyperdx/otel-collector Patch

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

@github-actions github-actions Bot added the review/tier-2 Low risk — AI review + quick human skim label Oct 5, 2026
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🔵 Tier 2 — Low Risk

Small, isolated change with no API route or data model modifications.

Why this tier:

  • Standard feature/fix — introduces new logic or modifies core functionality

Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns.
SLA: Resolve within 4 business hours.

Stats
  • Production files changed: 6
  • Production lines changed: 60 (+ 364 in test files, excluded from tier calculation)
  • Branch: hdx-4900-support-series-limit-for-promql-charts
  • Author: karl-power

To override this classification, remove the review/tier-2 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Duplicate code analysis

No new duplicate code introduced by this PR.


jscpd compared this branch against origin/main
across app, api and common-utils. Only new clones are listed; the codebase
currently holds 128 in total (1.79%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

@@ -340,6 +341,7 @@ export function convertFormStateToChartConfig(
'fillNulls',
'alignDateRangeToGranularity',
'alternateRowBackground',
'seriesLimit',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — Changing the client-side PromQL Series Limit re-runs the Prometheus query

seriesLimit now goes into the PromQL queried config. convertToTimeChartConfig (packages/app/src/ChartUtils.tsx:239) only removes it for builder configs, and DBTimeChart puts the whole queriedConfig in the useQueriedChartConfig queryKey (DBTimeChart.tsx:496-498). So editing a cap that only affects rendering fetches from Prometheus again. Fix: drop seriesLimit from non-builder configs in convertToTimeChartConfig. DBTimeChart reads the cap from config.seriesLimit, not queriedConfig, so the render cap still works.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

PR Review

If you are a coding agent acting for the author, read this first.
Nothing below blocks merge automatically; a maintainer decides. What they will expect:

  • 🔴 critical or 🟠 major in code this PR adds or changes: fix before asking for review.
  • 🔵 minor in code this PR changes: your call. Fix if small, otherwise reply.
  • Anything about surrounding code, or asking you to widen the change (hoist a helper,
    dedupe with another file, fix other call sites): never fix here, whatever the
    severity. Reply with one sentence; if it is critical, say so plainly so a human sees it.

One commit per review round. After two rounds, stop and ask a maintainer to review
scope rather than addressing more automated findings. Full rule: AGENTS.md.

1 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 1 minor

1 posted as inline comment(s) on the changed lines.


Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides.

@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds series limit feature to PromQL time and categorical charts.

The PR appears safe to merge, with a non-blocking mismatch between the PromQL categorical limit control and its 500-group rendering ceiling.

Fix All in Claude CodeFindings

  1. P2 Categorical limit stops at 500 ▶

Summary

The PR adds a persisted, client-side Series Limit for PromQL time charts and extends the setting to pie and bar charts.

  • Time charts can warn about hidden series and offer load-all, with PromQL-specific cardinality guidance.
  • Pie and bar charts retain the largest values, subject to an existing 500-group ceiling that the new control does not explain.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[PromQL chart setting] --> B[Saved chart config]
  B --> C[Query result]
  C --> D{Display type}
  D -->|Line or stacked bar| E[Time-series render cap and warning]
  D -->|Pie or bar| F[Sort values descending]
  F --> G[Render up to requested limit, capped at 500]
Loading

Reviews (3) · Last reviewed commit: "support promql series limit on pie and b..."

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found.

This is a small, well-scoped, well-tested change. The core mechanism (persisting seriesLimit in the two PromQL pick lists, then letting the already-existing client-side render cap and the new maxGroups path consume it) is sound, and the edge cases (0 = unlimited, null = default, positive = cap, min(maxGroups, 500) memory guard) are handled consistently and covered by unit and e2e tests. The prior reviewer request to reload the dashboard in the persistence e2e test is addressed (promql-series-limit.spec.ts now reloads and re-asserts the capped series count and load-all before the editor round-trip).

The items below are minor and non-blocking.

🔵 P3 nitpicks (2)
  • packages/app/src/utils/chartConfig.ts:9 — Persisting seriesLimit into PromQL configs puts a purely client-side cap into the react-query key, so changing the limit triggers a redundant Prometheus refetch that returns identical data; stripClientSideConfigFields strips only the reducer, and convertToTimeChartConfig spreads seriesLimit through for PromQL time charts (ChartUtils.tsx:240), so both the categorical key (CategoricalChart.tsx:81) and the time-chart key (DBTimeChart.tsx:498) re-key on it.
    • Fix: Strip seriesLimit in stripClientSideConfigFields for PromQL and exclude it from the PromQL time-chart query key so a client-only cap change reuses the cached response.
  • packages/app/src/components/ChartDisplaySettingsDrawer.tsx:399 — The categorical Series Limit description says "Leave empty to fetch all," but for PromQL pie/bar Prometheus always returns every series and the client caps display at min(limit, 500); a PromQL categorical chart exceeding 500 series silently shows 500 with no hidden-series indicator (unlike time charts).
    • Fix: Reword the categorical description for PromQL to reflect a client-side display cap, or surface a hidden-count notice on PromQL categorical charts.

Reviewers: correctness, testing, maintainability, performance, kieran-typescript, previous-comments.

Testing gaps: The PromQL time-chart render cap wiring (maxSeries via resolveRenderedSeriesCap(config.seriesLimit) in DBTimeChart.tsx) is exercised only through the e2e spec; a focused unit test of that wiring would harden it against regressions, though resolveRenderedSeriesCap and the categorical maxGroups path do have direct unit coverage.

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

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 399 passed • 1 skipped • 1470s

Status Count
✅ Passed 399
❌ Failed 0
⚠️ Flaky 0
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

@karl-power
karl-power force-pushed the hdx-4900-support-series-limit-for-promql-charts branch from 6077f92 to d3a96ee Compare October 5, 2026 15:22
pulpdrew
pulpdrew previously approved these changes Oct 6, 2026

@pulpdrew pulpdrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - could we also support this for pie and bar charts?

@karl-power
karl-power force-pushed the hdx-4900-support-series-limit-for-promql-charts branch from d3a96ee to 9506452 Compare October 6, 2026 13:52
Comment thread packages/app/src/ChartUtils.tsx Resolved
@karl-power

Copy link
Copy Markdown
Contributor Author

LGTM - could we also support this for pie and bar charts?

done!

@kodiakhq
kodiakhq Bot merged commit 76e5cf7 into main Oct 6, 2026
32 checks passed
@kodiakhq
kodiakhq Bot deleted the hdx-4900-support-series-limit-for-promql-charts branch October 6, 2026 14:03

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — 95064527 Deployed Oct 6, 2026 by vercel[bot]
Preview – hyperdx-storybook — 95064527 Deployed Oct 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge review/tier-2 Low risk — AI review + quick human skim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants