feat(dashboard): support per-dashboard defaultTimeRange
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 9.9k
- Forks
- 471
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 117
Description
Problem
Dashboard time picker always defaults to Last 1 hour on first open (no URL params). For dashboards that aggregate slow-moving data — daily team usage, weekly cost rollups, sessions that span 10+ minutes — a 1-hour window often shows no rows, requiring every viewer to manually widen the picker before the dashboard becomes useful.
There's currently no way to configure a per-dashboard default. The mongoose Dashboard schema in packages/api/src/models/dashboard.ts (verified at tag @hyperdx/api@2.24.1) only stores:
name, tiles, tags, filters, savedQuery, savedQueryLanguage, savedFilterValues, containers
URL query params (?from=now-24h&to=now) work as a workaround, but require every team member to bookmark/share the with-params URL — a friction point that defeats the purpose of "open the dashboard and see your data."
Proposed change
Add an optional defaultTimeRange field to the Dashboard schema:
defaultTimeRange?: {
from: string; // e.g. "now-24h", "now-7d", or absolute ISO
to: string; // e.g. "now"
}
Frontend behavior on dashboard open:
- If
from/toURL query params are present → use them (existing behavior, highest priority). - Else if
dashboard.defaultTimeRangeis set → use it. - Else → existing global default (Last 1h).
Manual picker changes continue to update the URL, so the user's interaction always wins.
Why per-dashboard, not global
Different dashboards genuinely need different defaults:
- Live error-rate dashboard wants 15 min.
- Team weekly cost rollup wants 7 days.
- Long-running pipeline runs dashboard wants 24 hours.
A single global default can't satisfy all three. Per-dashboard config is the right grain.
Implementation sketch
-
packages/common-utils/src/types.tsDashboardSchema(andBaseDashboardSchema): adddefaultTimeRange: z.object({ from: z.string(), to: z.string() }).optional() -
packages/api/src/models/dashboard.ts: add the field to the mongoose schema (mixed or typed). -
External API (
/api/v2/dashboards) request body schema: pass throughdefaultTimeRange. -
MCP
hyperdx_save_dashboardtool schema: same. -
Frontend dashboard page: in the time-range hydration path, prefer URL params →
dashboard.defaultTimeRange→ existing global default. -
(Optional) Dashboard settings UI: a small "Default time range" form on the dashboard edit page.
Happy to put up a PR if the maintainers are open to the direction — wanted to file the issue first to confirm scope.
Workaround documented for users until then
Bookmark URL with explicit query params, e.g.:
https://<host>/dashboards/<id>?from=now-24h&to=now
Works today, but doesn't survive sharing via plain /dashboards/<id> links.
Related issues
- hyperdxio/hyperdx#1594 fixed URL params on the Services dashboard, but didn't add a saved default.
- hyperdxio/hyperdx#29 covered global 12h/24h time format, different concern.
Versions
- HyperDX
@hyperdx/api@2.24.1,@hyperdx/app@2.24.1 - ClickStack helm chart
2.1.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/common-utils/src/types.ts and packages/api/src/models/dashboard.ts, then trace the external dashboard API, hyperdx_save_dashboard schema, and the frontend dashboard time-range hydration path. Verify that URL parameters override the saved range, the dashboard range overrides the global default, and the existing default remains the fallback. Confirm the field can be saved and returned through each listed interface.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- full-stack
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100