Skip to content
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

Pretty printed dashboard export #257

Closed
kongslund opened this issue Jun 27, 2022 · 2 comments · Fixed by #259
Closed

Pretty printed dashboard export #257

kongslund opened this issue Jun 27, 2022 · 2 comments · Fixed by #259

Comments

@kongslund
Copy link
Contributor

SUMMARY

Support exporting a dashboard with pretty printed JSON so that it becomes easier to compare changes with the previous version.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

grafana_dashboard

ADDITIONAL INFORMATION

Often when I export dashboards, I have a need to compare them with previous versions.

I use the grafana_dashboard module for exporting the dashboards. The current JSON output is compact and not so easy to compare in a diff, so I have an additional step of pretty printing each exported dashboard file.

It would be more convenient for this use case if grafana_dashboard supports pretty printing out of the box.

I see two possible approaches to introducing this:

A) Change grafana_dashboard to always export dashboards as pretty printed. I prefer this one.
B) Add a module option export_style which determines if the resulting JSON should be compact as today or pretty printed. The two allowed values would be compact (default) and pretty.

Example:

- name: Export a pretty dashboard
  grafana_dashboard:
    grafana_url: "..."
    grafana_user: "..."
    grafana_password: "..."
    state: export
    export_style: pretty
    path: /a/pretty/dashboard.json
    overwrite: true
    uid: "{{ dashboard_uid }}"

Would there be interest if I create a PR for either approach A or B?

@rrey
Copy link
Collaborator

rrey commented Jul 4, 2022

Hi @kongslund, solution A is good and a PR is welcome ! Thanks 🙏🏻 !

kongslund added a commit to kongslund/community.grafana that referenced this issue Jul 4, 2022
rrey pushed a commit to kongslund/community.grafana that referenced this issue Jul 10, 2022
@rrey rrey closed this as completed in #259 Jul 17, 2022
rrey pushed a commit that referenced this issue Jul 17, 2022
@rrey
Copy link
Collaborator

rrey commented Jul 17, 2022

Just release v1.5.1 which include the fix for this issue. It should be available on Galaxy soon.
Thanks @kongslund !

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 a pull request may close this issue.

2 participants