hyperdxio / hyperdxio/hyperdx

feat(dashboard): support per-dashboard defaultTimeRange

Open
#2,254 1 comment 0 reactions 0 assignees View on GitHub

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:

  1. If from/to URL query params are present → use them (existing behavior, highest priority).
  2. Else if dashboard.defaultTimeRange is set → use it.
  3. 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

  1. packages/common-utils/src/types.ts DashboardSchema (and BaseDashboardSchema): add

    defaultTimeRange: z.object({ from: z.string(), to: z.string() }).optional()
    
  2. packages/api/src/models/dashboard.ts: add the field to the mongoose schema (mixed or typed).

  3. External API (/api/v2/dashboards) request body schema: pass through defaultTimeRange.

  4. MCP hyperdx_save_dashboard tool schema: same.

  5. Frontend dashboard page: in the time-range hydration path, prefer URL params → dashboard.defaultTimeRange → existing global default.

  6. (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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.