scalyr / scalyr-grafana-datasource-plugin

Apache License 2.0
14 stars 5 forks source link

Template parameters (grafana variables) are only appended to the end of a query #29

Closed jmorascalyr closed 4 years ago

jmorascalyr commented 4 years ago

When we add template parameters, I would like to be able to define the param wherever i want in the query but the params are appended to the end of the request.

For example, I would like to be able to define a list of params in Grafana

host = server1, server2, server3

and select server1 from the dropdown.

with the following query:

dataset = 'accesslog' && $serverHost = '[[host]]'

I would expect. the body of the response to be

data:"{"token":"token","queries":[{"startTime":1575658166918,"endTime":1575659917468,"buckets":1750,"filter":"dataset='accesslog' $serverHost == 'server1'","function":"mean(time)"}]}"

But instead, i get

data:"{"token":"token","queries":[{"startTime":1575658166918,"endTime":1575659917468,"buckets":1750,"filter":"dataset='accesslog' $serverHost == '[[host]]' server1","function":"mean(time)"}]}"

adknownadmin commented 4 years ago

Not sure if this should be a separate issue, but when I try using grafana variables of type "query" with a MySQL datasource, it's appending the query of the grafana variables as well as the currently selected results of the grafana variable queries to the scalyr query.

Not only that, but within the appended grafana variable queries, the results appear to be inverted.

Pic attached of the query inspector output image