GoshPosh / grafana-meta-queries

Grafana plugin for calculating time period metrics like week over week, month over month and year over year etc.
Apache License 2.0
283 stars 71 forks source link

Apply template variables in expression #77

Closed chengyanQtl closed 2 years ago

chengyanQtl commented 4 years ago

Issue: #11 Method: Replacing the template variable in expression with its current value when query before the expression evaluated. Attention: Only support variable format $varname with greedy matching for now. I am a newbie of javascript. Any modify are always welcome. Result:

Screenshot from 2019-10-10 16-12-21

beingyash commented 4 years ago

@Gauravshah This PR seems to be functional from the screenshot. Any plans on getting it merged?

This would be a really helpful feature to optimize the usage of metaqueries datasource since as of now each metaqueries query requires 2 data fetching queries to fetch the data to be operated upon, every time the panel is refreshed. Using a template variable to get one of the value for the arithmetic operation would half the number of those needlessly recurring queries.

OscarLopezEns commented 3 years ago

Hi, any update on getting this unblocked?

ShilpaSivanesan commented 2 years ago

@chengyanQtl When I directly add the modification to my branch, it works, however pulling your branch breaks nested meta queries. could you please check ?

Also please include src/datasource.js

ShilpaSivanesan commented 2 years ago

Fixing the PR https://github.com/GoshPosh/grafana-meta-queries/pull/143