Skip to content

feat(dashboard): support per-dashboard defaultTimeRange #2254

@minhcramiumlabs

Description

@minhcramiumlabs

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

Versions

  • HyperDX @hyperdx/api@2.24.1, @hyperdx/app@2.24.1
  • ClickStack helm chart 2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions