Skip to content

Create a tool to deploy an ephemeral grafana job with local changes - #13487

Open
vanja-p wants to merge 2 commits into
masterfrom
vanja-grafana-preview
Open

vanja-p wants to merge 2 commits into
masterfrom
vanja-grafana-preview

Conversation

@vanja-p

@vanja-p vanja-p commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

This lets us share custom dashboards, as well as any changes in pending PRs.

The job gets automatically deleted in 3 days if the users forgets to delete it.

This lets us share custom dashboards, as well as any changes in pending PRs.

The job gets automatically deleted in 3 days if the users forgets to delete it.

@buildbuddy-io buildbuddy-io Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds a tool that deploys a temporary Grafana Job to the dev monitoring cluster with local dashboard changes, so dashboards can be previewed before merging. The Job is meant to delete itself after 3 days if the user forgets to tear it down.

Comment thread tools/metrics/grafana/preview/preview.go
Comment thread tools/metrics/grafana/preview/preview.go
Comment thread tools/metrics/grafana/preview/preview.go Outdated
if err != nil {
return "", fmt.Errorf("determine current user: %w", err)
}
name := strings.Trim(nonLabelChars.ReplaceAllString(strings.ToLower(u.Username), "-"), "-")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two users can end up with the same default suffix, so one can delete the other's preview. currentUser lowercases the username, turns every run of other characters into -, and truncates to 24 characters, so different usernames can map to the same suffix. up starts by deleting everything with the matching label (line 288).

For example, j.doe and j_doe (or J-Doe) all get the suffix j-doe, and when one of them runs up it silently tears down the other's preview. This is low severity. Consider warning before deleting a Job this machine didn't create, for example by recording the real username in an annotation and checking it first.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems ok for now. This data shouldn't be critical

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant