This will allow Grafana to automatically show functions and parameters available in the target graphite instance, including functions loaded via plugins.
Work is not complete yet, but it is functional.
@torkelo there is still something funny going on here that I suspect I exposed via the change to quote non-numeric values provided for numeric parameters, which caused scaleToSeconds(#A) to get rendered as scaleToSeconds('#A') because it ends up using the def param for the seconds param. I tweaked the test a bit to pass an explicit seconds param and when I do that the #A just vanishes altogether.
I created a small branch to demonstrate the issue, as far as I can see this is an existing bug that my changes just brought to light.
Merging #10139 into master will decrease coverage by <.01%.
8d59845 is a really quick demo of using rst2html to render the graphite docstring to HTML, I'm not sure what the best way to integrate that into the UI would be, @mattttt do you have any suggestions?
Just a heads up, the current client side text filtering matches values that contain the search term, not just those that begin with it. I'm not sure if anyone relies on that particular behavior.
for tags only prefix matching is supported on the server, I could change the code in the last commit to build the pattern like *<prefix>*, which might be better for backward compatibility.
The update in abfd18c supports getting a list of values for a specified tag by specifying a template variable query as tagValues("<tag>"). This works, but I feel like there should be a more elegant solution.
The supported syntax for tag & tag value lookups in template variables is now tag_values(<tag>, <expression>*) for values and tags(<expression>*) for tags. They use the auto-complete functionality to get the lists from graphite.
@torkelo I think this is ready for you to take a look at. One thing I haven't yet been able to figure out is that every now and then the popovers for the function dropdowns don't close properly. Not sure if you have a better way of handling them, I was having a lot more issues when trying to use the popoverSrv for them, possibly because of the way the typeahead elements get removed from the DOM.
The tag_values function and play button are awesome.
The play button disappears after it's clicked. Any new edits become immediately applicable.
tag_values seems limited to 100 results. Perhaps that could be passing in to the function call somehow?
@shanson7 Thanks for the feedback!
Initially I had the play button change to pause so you could toggle it back again, but it seemed cleaner to just have it go away.
As far as tags & tag_values they should be sending limit=10000 in the request, but it seems that they aren't right now. I'll check that out.
@shanson7 tag_values should be fixed now.
It doesn't seem like the tag key autocomplete request replaces template variables.
In the template variables I am to successfully build up a multiple template variables using both find and the new tag_values function.
Arguably worse, it seems that when going back in to edit the panel, it puts focus in that value box and removes the value that was there.
Ok, I'll have to take a look but I'm betting the autocomplete doesn't do the variable interpolation. Do the template variables work in the actual query?
This looks really great. Since most of the code changes are in tricky test angular directives I guess we can be a bit lax with test coverage. But some tests for getFuncDefs and new code in metricFindQuery would be good.
Also the popover in the function selection menu gets stuck quite option. I can take a look at that.
this function is quite long and does quite a bit, would be nice with some unit tests for the response handling of the function definitions.
this is a problem, if we do not remove the current value the typeahead wont show alternatives.