grafana-toolbox / grafana-wtf

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

Support jq-like filtering and transformation #1

Open amotl opened 5 years ago

amotl commented 5 years ago

It would be cool to support something like the jq query and transformation language for querying and filtering data requested from the Grafana API, like outlined within https://github.com/grafana/simple-json-datasource/issues/111.

amotl commented 5 years ago

We started collecting some ideas about this at [1] and started a discussion topic dedicated to further development of grafana-wtf [2]. Feel welcome to join us there.

[1] https://community.panodata.org/t/tools-for-processing-json/65 [2] https://community.panodata.org/t/developing-grafana-wtf/67

markmelville commented 4 years ago

When it comes to JSON transformations, I have been loving Jsonata. The syntax is terse and powerful although sometimes hard to remember. It is also extensible by adding custom functions.

Another option would be to use JMESPATH, which is what is used in the aws-cli to transform the responses from various commands. I am not aware of a javascript implementation.

amotl commented 4 years ago

Dear Mark,

thanks for bringing up JSONata in this context. I recently stumbled upon it as well [1] and liked it on a first glimpse. Thanks also for suggesting JMESPath.

Feel free to come up with a respective implementation based on whatever you might like most.

With kind regards, Andreas.

[1] https://community.panodata.org/t/jsonata-json-query-and-transformation-language/64

amotl commented 1 year ago

I just discovered an interesting technique to interactively override application settings when they are originally stored in a YAML file, using yq in the application, by @afbjorklund.

limactl start --set='.cpus = 2 | .memory = "2GiB"'

-- https://github.com/lima-vm/lima/pull/1359