Skip to content

feat: Add file-based dashboard provisioner#1962

Merged
kodiakhq[bot] merged 2 commits into
hyperdxio:mainfrom
ZeynelKoca:feature/dashboard-provisioner
May 19, 2026
Merged

feat: Add file-based dashboard provisioner#1962
kodiakhq[bot] merged 2 commits into
hyperdxio:mainfrom
ZeynelKoca:feature/dashboard-provisioner

Conversation

@ZeynelKoca

@ZeynelKoca ZeynelKoca commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Add a provision-dashboards task that reads .json files from a directory and upserts dashboards into MongoDB, following the existing task system pattern (same as check-alerts).

Provisioned dashboards are flagged with provisioned: true so they never overwrite user-created dashboards with the same name. Files are validated against DashboardWithoutIdSchema. Removing a file does not delete the dashboard (safe by default, same as Grafana). The task is deployment-agnostic: it reads from a directory, regardless of how files get there.

When DASHBOARD_PROVISIONER_DIR is set, entry.prod.sh automatically starts the task as an additional process alongside the API, App, and check-alerts.

Note: Users can currently edit provisioned dashboards through the UI, but changes will be overwritten on the next sync cycle. Grafana handles this by blocking saves on provisioned dashboards. Adding a similar guard would be a good follow-up to improve UX.

Variable Required Default Description
DASHBOARD_PROVISIONER_DIR Yes Directory to read .json files from
DASHBOARD_PROVISIONER_TEAM_ID No* Scope to a specific team ID
DASHBOARD_PROVISIONER_ALL_TEAMS No* false Set to true to provision to all teams

*One of DASHBOARD_PROVISIONER_TEAM_ID or DASHBOARD_PROVISIONER_ALL_TEAMS=true is required.

How to test locally or on Vercel

  1. Create a directory with a dashboard JSON file:
    mkdir /tmp/dashboards
    echo '{"name":"Test Dashboard","tiles":[],"tags":[]}' > /tmp/dashboards/test.json
  2. Run the task:
    DASHBOARD_PROVISIONER_DIR=/tmp/dashboards DASHBOARD_PROVISIONER_ALL_TEAMS=true
    ./packages/api/bin/hyperdx task provision-dashboards
  3. Verify the dashboard appears in the UI
  4. Modify the JSON file, run again, verify it updates
  5. Delete the JSON file, run again, verify the dashboard persists

References

@changeset-bot

changeset-bot Bot commented Mar 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0828fbc

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

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

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

@vercel

vercel Bot commented Mar 22, 2026

Copy link
Copy Markdown

@ZeynelKoca is attempting to deploy a commit to the HyperDX Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

PR Review

✅ No critical issues found.

A few minor observations (non-blocking):

  • ⚠️ entry.prod.sh only checks DASHBOARD_PROVISIONER_DIR; if the user sets it without TEAM_ID/ALL_TEAMS, the task will silently fail-and-retry every minute (validation throw is caught in tasks/index.ts:main). Consider a friendlier startup check in entry.prod.sh (or surface a one-time WARN log) → not a correctness bug, just UX.
  • ⚠️ syncDashboards does a non-atomic Dashboard.exists warning lookup before the upsert. If a user creates a dashboard with the same name between those two ops, only the warning is missed — the partial unique index { name, team } (provisioned-only) still guarantees data integrity. Acceptable.
  • ℹ️ asyncDispose closes the mongoose connection on every cron tick (re-opened via connectDB() in execute). This mirrors the checkAlerts provider pattern, so it's consistent — flagging only because it's worth being aware of for long-running deployments.
  • ℹ️ Known UX limitation already called out in the PR description: provisioned dashboards remain editable in the UI and get overwritten next sync. Follow-up to block edits would be valuable but is out of scope.

Nice test coverage — both unit (readDashboardFiles) and integration (syncDashboards, full task) paths are exercised, including the user-vs-provisioned coexistence case.

@ZeynelKoca ZeynelKoca force-pushed the feature/dashboard-provisioner branch 17 times, most recently from 4c24c45 to abdafb3 Compare March 22, 2026 23:40
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Mar 22, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
@ZeynelKoca ZeynelKoca force-pushed the feature/dashboard-provisioner branch 5 times, most recently from 3e9be8a to ffe6158 Compare March 23, 2026 12:43
@ZeynelKoca ZeynelKoca changed the title Add file-based dashboard provisioner featu: Add file-based dashboard provisioner Mar 23, 2026
@ZeynelKoca ZeynelKoca changed the title featu: Add file-based dashboard provisioner feat: Add file-based dashboard provisioner Mar 23, 2026
@ZeynelKoca ZeynelKoca force-pushed the feature/dashboard-provisioner branch from ffe6158 to 10ae4d2 Compare March 24, 2026 08:21
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Apr 3, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
@ZeynelKoca ZeynelKoca force-pushed the feature/dashboard-provisioner branch from f914080 to 6023b15 Compare April 3, 2026 22:14
@github-actions github-actions Bot added the review/tier-4 Critical — deep review + domain expert sign-off label Apr 6, 2026
@github-actions

github-actions Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

🔴 Tier 4 — Critical

Touches auth, data models, config, tasks, OTel pipeline, ClickHouse, or CI/CD.

Why this tier:

  • Critical-path files (4):
    • docker/hyperdx/entry.prod.sh
    • packages/api/src/tasks/index.ts
    • packages/api/src/tasks/provisionDashboards/index.ts
    • packages/api/src/tasks/types.ts

Review process: Deep review from a domain expert. Synchronous walkthrough may be required.
SLA: Schedule synchronous review within 2 business days.

Stats
  • Production files changed: 5
  • Production lines changed: 200 (+ 351 in test files, excluded from tier calculation)
  • Branch: feature/dashboard-provisioner
  • Author: ZeynelKoca

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

ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Apr 7, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
@ZeynelKoca

Copy link
Copy Markdown
Contributor Author

@dhable Gentle bump to avoid the rebase-loop hell

@ZeynelKoca ZeynelKoca requested a review from dhable April 29, 2026 08:02
@kodiakhq kodiakhq Bot merged commit 4c2c3f3 into hyperdxio:main May 19, 2026
16 of 18 checks passed
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jun 30, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jun 30, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jun 30, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jun 30, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jun 30, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jun 30, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jun 30, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jun 30, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jun 30, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jul 1, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jul 1, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jul 1, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jul 1, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jul 1, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jul 1, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
ZeynelKoca added a commit to ZeynelKoca/ClickStack-helm-charts that referenced this pull request Jul 1, 2026
k8s-sidecar watches ConfigMaps labeled "hyperdx.io/dashboard: true"
across all namespaces and writes dashboard JSON to a shared volume.
HyperDX reads and upserts them natively via file-based provisioner.

Requires hyperdxio/hyperdx#1962
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge review/tier-4 Critical — deep review + domain expert sign-off waiting-on-engineering

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants