grafana-toolbox / grafana-wtf

Grep through all Grafana entities in the spirit of git-wtf.
GNU Affero General Public License v3.0
144 stars 13 forks source link

Add `explore dashboards --data-details` option #89

Closed amotl closed 10 months ago

amotl commented 10 months ago

Dear @meyerder,

related to your request at GH-70,

I have been trying to play with the jq syntax to extract the SQL statements of the data sources and not been able to do so yet. Do you have any suggestions?

this patch extends the output of grafana-wtf explore dashboards by many more details about data inquiry / queries, when adding the --data-details option. It will generate massive output, at your disposal for subsequent filtering.

When combining it with jq in this way, you can generate a flat list of all data queries used within all dashboards:

grafana-wtf explore dashboards --data-details --format=json | \
    jq -r '.[].details | values[] | .[].query // "null"'

You can install the package including this feature directly from the corresponding branch using this pip command:

pip install --upgrade 'git+https://github.com/panodata/grafana-wtf@amo/explore-dashboards-data-details'

I will be happy to hear back from you if you think this is useful in one way or another. If you think it is not enough, and would need further improvements to handle your use case, let me know.

With kind regards, Andreas.

amotl commented 10 months ago

Now, after integrating this improvement already, you can install the development version like this:

pip install --upgrade 'git+https://github.com/panodata/grafana-wtf'