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

Support data path in Global Variable query #35

Closed
ggranberry opened this issue Nov 9, 2020 · 8 comments
Closed

Support data path in Global Variable query #35

ggranberry opened this issue Nov 9, 2020 · 8 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ggranberry
Copy link
Contributor

Currently when trying to assign a result from a Graphql Datasource into a Global Variable, there is no option to specify a data path leading to an inability to assign any values

Screen Shot 2020-11-09 at 5 23 06 PM

@retzkek retzkek added bug Something isn't working enhancement New feature or request help wanted Extra attention is needed and removed bug Something isn't working labels Nov 9, 2020
@ggranberry
Copy link
Contributor Author

I can tackle this PR if you want to assign it to me.

@retzkek
Copy link
Contributor

retzkek commented Nov 10, 2020

Thanks for opening this issue, to be honest I haven't looked into what it would take to support using the datasource for query variables. Historically this has been rather disconnected from the datasource, with a unique editor, query language, etc. I see there's now some documentation on supporting query variables, looks pretty straightforward.

@retzkek
Copy link
Contributor

retzkek commented Nov 10, 2020

@ggranberry absolutely, let me know if you run into any issues. The main challenge I see is that we need to ensure that we get an array of simple values out, rather than objects.

@ggranberry
Copy link
Contributor Author

@retzkek How would you recommend implementing metricFindQuery? I was thinking of just calling query and then parsing the output

@retzkek
Copy link
Contributor

retzkek commented Nov 10, 2020

@ggranberry Good question... my first instinct is to use createQuery() and getDocs() directly, since there's a lot of extra stuff that query() handles (multiple targets, time fields, grouping, aliases) that shouldn't apply in this context.

@ggranberry
Copy link
Contributor Author

Hey just getting back to this and I was wondering if you had any documentation on how to build/test this? I was just going to try to install it into a local grafana docker image to test it out. Do I need to do anything besides copy this dir to the plugins folder?

@retzkek
Copy link
Contributor

retzkek commented Dec 1, 2020

Yep that's all there is to it, or you can set the Grafana plugins directory, e.g. if I have the repo at /Users/kretzke/fifemon/graphql-datasource:

/usr/local/bin/grafana-server --homepath /usr/local/share/grafana cfg:default.paths.plugins=/Users/kretzke/fifemon

Or with Docker:

docker run -it --rm -v /Users/kretzke/fifemon:/var/lib/grafana/plugins -p 3000:3000 grafana/grafana

Note that you need to restart Grafana anytime you've changed the plugin (after running yarn dev).

@ggranberry
Copy link
Contributor Author

PR is up whenever you have time to review 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants