How to change metric/grouping of metricpanel (Aggregations) in plugin

Hey there!
i am trying to implement a plugin with an own tab.(In the clockpanel it is the editor.html… tab)
In this new created editortab i want to minimize the resultset of the metric panel aggreagations.

My defined settings in my extratab should set a predefined query. (Metric, Grouping, lucene…)
For example: in the extratab is a dropdown menu. One entry is ‘showUser’… the metricpanel aggregations should be set to grouped by user…
How do i do that?..

I really appreciate every help !

Do you really need an own plugin for that? Why you can’t use dashboard variables (see example https://grafana.com/dashboards/635)?

dashboard variables are a good idea… but i want to end up with a dashboard that someone can use without prior knowledge about databases and elastic. In the drop down I connect with a dropdown Definition not only one instruction but three. (statment:‘cook’ And type:‘agent’)

So this is really meant for custom use.

@

(https://community.grafana.com/u/jangaraj) But still thanks for the quick advice!

Custom dashboard variable doesn’t stop you to predefine multiple lucene conditions, which you can use in the query:

Own panel seems to be an overkill - you will need to modify every type of panel (graph, singlestat, table), which you want to use in the dashboard. It makes sense only if you need a very high level of user experience for non tech users. But the maintenance cost of this custom solution will be high (own deployment, bug fixing, Grafana compatibility, …).

Is it possible that the lucenequery is no longer displayed but a kind of alias? this means that there is no longer “statement”: “cook” AND… in it but simply cook ? (no lucene).

In addition I want to limit the choices. in the dropdown not all should be shown but only specific ones…

jangaraj

i also want to affect the grouping and the MIN/MAX/AVERAGE…the whole query in one filteroption. this is why i want to implement a drop down in my plugin… This plugin is only for costum use !

See How to alias a template variable value