akoutmos / prom_ex

An Elixir Prometheus metrics collection library built on top of Telemetry with accompanying Grafana dashboards
MIT License
606 stars 105 forks source link

[FEATURE] Add a mix task to render the json for manual import into Grafana #135

Open nacengineer opened 2 years ago

nacengineer commented 2 years ago

Thanks for all the work on this mix module.

This might be a dumb request but our production servers don't have access to our Grafana instance so auto publishing to Grafana, while nice, isn't really something we can do.

I think I see the dashbaords in the /priv directory with a little EEX inject but IMO it would be nice to have a mix task that just spits out the dashboards into STDOUT for copy and paste into Grafana. Automation is always nice right up until it isn't. 😀

lairtonlelis commented 2 years ago

I was able to generate each dashboard that I was using individually by using the following mix task:

mix prom_ex.dashboard.export --dashboard application.json --file-path application.json

You need to replace application with the dashboard you want to export. This will generate a file in priv/application.json that you can use to import to Grafana.

lairtonlelis commented 2 years ago

You can find the documentation for this command here:

https://hexdocs.pm/prom_ex/Mix.Tasks.PromEx.Dashboard.Export.html