-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tool(grafana): test/tooling to ensure dashboards are simplified/importable #264
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
huntergregory
added
area/infra
Test, Release, or CI Infrastructure
area/data-ingestion-and-visualization
labels
Apr 15, 2024
huntergregory
changed the title
feat(grafana): test/tooling to ensure dashboards are simplified/importable
tool(grafana): test/tooling to ensure dashboards are simplified/importable
Apr 15, 2024
snguyen64
requested changes
Apr 24, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this change, could you rebase and resolve conflicts first?
…ion-ready) Signed-off-by: Hunter Gregory <[email protected]>
Signed-off-by: Hunter Gregory <[email protected]>
huntergregory
force-pushed
the
huntergregory/simplify-grafana-tooling
branch
from
April 24, 2024 20:09
e73ef47
to
1173df1
Compare
snguyen64
approved these changes
Apr 24, 2024
nddq
pushed a commit
that referenced
this pull request
May 6, 2024
…table (#264) # Description When it comes to JSON for Grafana dashboards, it seems best practice to remove a bunch of unnecessary pieces like the name of your personal datasource, current variable selection, etc. This PR: 1. Introduces `make simplify-dashboards` to automate this tedious process. 2. Adds a unit test to ensure authors run this command. ## Related Issue ## Checklist - [x] I have read the [contributing documentation](https://retina.sh/docs/contributing). - [x] I signed and signed-off the commits (`git commit -S -s ...`). See [this documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification) on signing commits. - [x] I have correctly attributed the author(s) of the code. - [x] I have tested the changes locally. - [x] I have followed the project's style guidelines. - [x] I have updated the documentation, if necessary. - [x] I have added tests, if applicable. ## Screenshots (if applicable) or Testing Completed ### `make simplify-dashboards` ```bash $ make simplify-dashboards cd deploy/grafana/dashboards/ && go test . -tags=dashboard,simplifydashboard -v === RUN TestOverwriteDashboards simplify-grafana-overwrite_test.go:22: simplifying/overwriting dashboard: clusters.json simplify-grafana-overwrite_test.go:22: simplifying/overwriting dashboard: dns.json simplify-grafana-overwrite_test.go:22: simplifying/overwriting dashboard: pod-level.json --- PASS: TestOverwriteDashboards (0.02s) PASS ok github.com/microsoft/retina/deploy/grafana/dashboards 0.019s ``` ### Unit Test to Ensure Simplification ```bash go test . -tags=dashboard -v === RUN TestDashboardsAreSimplified simplify-grafana_test.go:24: verifying that dashboard is simplified: clusters.json simplify-grafana_test.go:31: ERROR: dashboard has not been simplified. Please run: make simplify-dashboards simplify-grafana_test.go:24: verifying that dashboard is simplified: dns.json simplify-grafana_test.go:24: verifying that dashboard is simplified: pod-level.json --- FAIL: TestDashboardsAreSimplified (0.01s) FAIL FAIL github.com/microsoft/retina/deploy/grafana/dashboards 0.018s FAIL ``` ## Additional Notes Code added in this PR is put behind the go build tag `dashboard`, so these files are not compiled in Retina binaries. --------- Signed-off-by: Hunter Gregory <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When it comes to JSON for Grafana dashboards, it seems best practice to remove a bunch of unnecessary pieces like the name of your personal datasource, current variable selection, etc. This PR:
make simplify-dashboards
to automate this tedious process.Related Issue
Checklist
git commit -S -s ...
). See this documentation on signing commits.Screenshots (if applicable) or Testing Completed
make simplify-dashboards
Unit Test to Ensure Simplification
Additional Notes
Code added in this PR is put behind the go build tag
dashboard
, so these files are not compiled in Retina binaries.