HyperDX Dashboard Provisioner#190
Conversation
🦋 Changeset detectedLatest commit: d0f332d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
Implements feature request #170 |
0243f23 to
752d6a5
Compare
|
@dhable Can we please look at this PR and see how we can progress it ? |
7d182d9 to
64af4b1
Compare
|
As per PR description, I redesigned the initial implementation to handle upsert behavior natively through hyperdx (same pattern as Grafana). This PR is dependent on hyperdxio/hyperdx#1962 |
04bbee1 to
5714065
Compare
dhable
left a comment
There was a problem hiding this comment.
Thank you for following up the feature change with a helm change as well. Great to keep these two up-to-date.
I think the need to provision RBAC roles and scan for tagged config maps is more than our typical users would expect from an application install. Using the default ConfigMap functionality to mount the dashboard data as a file would avoid the need for an additional service account, RBAC, etc.
bd006b9 to
a437052
Compare
No worries, the dashboard provisioning would be really nice for us as we're planning to go into production with clickstack soon and implementing missing features is faster than creating an issue 😄 Ready for another review! |
|
@dhable Gentle bump. Happy to hear your thoughts on the implementation |
|
@dhable it would be great if this feature could be released! Very handy. |
## 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:
```bash
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
- Related PRs: ClickHouse/ClickStack-helm-charts#190
a437052 to
b577121
Compare
Deep Review✅ No critical issues found. The dashboard-provisioning feature is well-constructed and unusually well-tested (~950 lines of new helm-unittest coverage). RBAC is safe-by-default: 🟡 P2 — recommended
🔵 P3 nitpicks (4)
Reviewers (7): correctness, security, reliability, adversarial, testing, maintainability, project-standards. Testing gaps:
|
c4c6715 to
c86387f
Compare
a5bf038 to
f43379e
Compare
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
f43379e to
d0f332d
Compare
Summary
hyperdx.io/dashboard: "true"across all namespacesDesign decisions
Dependencies