feat: Add file-based dashboard provisioner#1962
feat: Add file-based dashboard provisioner#1962ZeynelKoca wants to merge 1 commit intohyperdxio:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 65f5509 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
|
@ZeynelKoca is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
PR ReviewThe implementation is well-structured and follows existing task patterns closely. A few items worth addressing:
|
4c24c45 to
abdafb3
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
3e9be8a to
ffe6158
Compare
ffe6158 to
10ae4d2
Compare
dhable
left a comment
There was a problem hiding this comment.
Thanks for the well thought out contribution. Overall this looks good but we don't typically have long running processes running as tasks inside the api process. We have put background processing like this as a task.
This approach provides a flexible deployment. Using our full stack image, we start the tasks as separate processes and then have a CronJob library manage scheduling of execution. For more advanced deployments, these scheduled tasks can run outside the main process, like using a k8s CronJob or other scheduling system.
I think this implementation could be easily adapted to that design since the startDashboardProvisioner() function is almost a direct fit for the task system. The check-alert task also needs to access Mongo so you should be able to connect in the same way.
packages/api/src/tasks/provisionDashboards/__tests__/provisionDashboards.test.ts
Show resolved
Hide resolved
122266f to
32daf0f
Compare
32daf0f to
65f5509
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
Reimplemented with the existing concurrent task system. Relevant ClickStack helm PR is also updated |
Summary
Add a
provision-dashboardstask that reads.jsonfiles from a directory and upserts dashboards into MongoDB, following the existing task system pattern (same ascheck-alerts).Provisioned dashboards are flagged with
provisioned: trueso they never overwrite user-created dashboards with the same name. Files are validated againstDashboardWithoutIdSchema. 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_DIRis set,entry.prod.shautomatically 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.
DASHBOARD_PROVISIONER_DIR.jsonfiles fromDASHBOARD_PROVISIONER_TEAM_IDDASHBOARD_PROVISIONER_ALL_TEAMSfalsetrueto provision to all teams*One of
DASHBOARD_PROVISIONER_TEAM_IDorDASHBOARD_PROVISIONER_ALL_TEAMS=trueis required.How to test locally or on Vercel
DASHBOARD_PROVISIONER_DIR=/tmp/dashboards DASHBOARD_PROVISIONER_ALL_TEAMS=true
./packages/api/bin/hyperdx task provision-dashboards
References