-
Notifications
You must be signed in to change notification settings - Fork 54
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 querying multiple repos at a time via query variables #90
Comments
This is probably related to this: Basically we have to refactor the https://github.com/grafana/github-datasource/blob/master/src/DataSource.ts#L29 There are some default formatting options you can try, though I am not sure that they will work. Maybe try the CSV option? |
Hm, I'm not sure I'm communicating the problem correctly (or perhaps I just don't understand what you're saying!) Basically, the variable replacement does work, it just doesn't substitute it as anything meaningful for repos. Github's api seems to only support My suggestion is splitting on the csv's commas in the code go code here, and turning those comma separated values into the format that github expects, |
@kminehart would you be willing to accept a pr to this effect? For the metrics we plan on collating with this plugin, we need support for multiple repos. |
Absolutely! Sorry I haven't quite gotten to a lot of the issues on here yet. This plugin is part of our work on the Enterprise Plugins team and we support a lot of datasources. :D To point you in the right direction, this should involve some changes in this function: https://github.com/grafana/github-datasource/blob/master/src/DataSource.ts#L29 |
@jsheffield-roblox did you ever manage to make any implementation to solve this issue? |
Problem
I would like to get metrics on multiple repos at a time. Technically, this is possible at the moment, just not with query variables.
I.E. Given the repos:
Org/repo_a
Org/repo_a
I can put the following in the query box
![Screen Shot 2020-10-21 at 12 06 06 PM](https://user-images.githubusercontent.com/70403061/96770896-d0daff00-1395-11eb-9b77-20fd2347700b.png)
repo:Org/repo_a repo:Org/repo_b
This works. However, the issue becomes when trying to use query variables to accomplish this.
![Screen Shot 2020-10-21 at 12 06 58 PM](https://user-images.githubusercontent.com/70403061/96770979-f10abe00-1395-11eb-9c57-923b1413f38c.png)
Using this variable like so:
![Screen Shot 2020-10-21 at 12 07 51 PM](https://user-images.githubusercontent.com/70403061/96771086-10095000-1396-11eb-8fa3-8b2ca90ffd48.png)
Just results in the query string being
repo:{Org/repo_a,Org/repo_b}
I was unable to find any way to transform this string into what I need using the builtin grafana interpolation, as it seems to only support either plugin defined formats or a list of predefined formats here
Proposed solution
I believe this could be accomplished by simply splitting on commas in the
repository
field, then separating each of those into their ownrepo:x
field in the query here, but I'm not sure if this is the best/desired way of accomplishing this.So the final result would look something like this
![Screen Shot 2020-10-21 at 12 27 08 PM](https://user-images.githubusercontent.com/70403061/96772975-c110ea00-1398-11eb-942a-42897b71d816.png)
where
$repo_name
is:Org/repo_a,Org/repo_b
etc, then the generated query isrepo:Org/repo_a repo:Org/repo_b
I'd be happy to create a pr to this effect, just want to make sure this is the "grafana" way of doing things and I'm not missing a better solution here!
The text was updated successfully, but these errors were encountered: