Skip to content
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

Tags query not removing single quote from template variable #102

Open
viv816 opened this issue Mar 8, 2018 · 7 comments
Open

Tags query not removing single quote from template variable #102

viv816 opened this issue Mar 8, 2018 · 7 comments

Comments

@viv816
Copy link

viv816 commented Mar 8, 2018

Hi,

Grafana Version= 4.1.2
Hawkular Version = 0.28.1.Final

I want to use variable value in tags QL as follows

Actual Query :

labels.app=$app AND metric_name='org.apache.camel:context=[[app]],name=*,type=routes#MaxProcessingTime'

Expected Result :

labels.app='demo-context' AND metric_name='org.apache.camel:context=demo-context,name=*,type=routes#MaxProcessingTime'

I want [[app]] to be replaced by demo-context instead of 'demo-context'. How do I do it?

The tags QL currently throws an error if it encounters single quote

@jotak
Copy link
Collaborator

jotak commented Mar 8, 2018

Can you try by turning off the tags edit mode?
As described here: https://github.com/hawkular/hawkular-grafana-datasource#queries (third image)

@viv816
Copy link
Author

viv816 commented Mar 10, 2018

Thanks for responding.

I still get error after turning off the tags edit mode. When I check the value for [[app]] after clicking the red icon on top left, the value is still enclosed in single quotes.

I want this as output

metric_name='org.apache.camel:context=ws-cifdetail,name=*,type=routes#Load01'

not this

metric_name='org.apache.camel:context='ws-cifdetail',name=*,type=routes#Load01'

Appreciate your help.

Thanks in advance.

Attaching the screen shots below.

error

error2

@jotak
Copy link
Collaborator

jotak commented Mar 12, 2018

Hi @viv816 ,
I'm trying to find the best way to solve this issue. The variable content is escaped in order to prevent failures in the tags parser, in constructs such as: my_tag IN [$app] , where a character like , or ] in $app would break the parsing.

A workaround could be to define a new "custom" variable in Grafana with nested $app, like this: metric_name='org.apache.camel:context=$app,name=*,type=routes#Load01' but unfortunately it doesn't seem to work for me, maybe you would have better luck? (nested variables are supposed to be supported in Grafana, but maybe it's only for variables of type "query", i'm not sure...)

@viv816
Copy link
Author

viv816 commented Mar 19, 2018

Hi @jotak ,

Thanks.

Is there any other way to solve this issue? Where can I find more help for this problem?

jotak added a commit to jotak/hawkular-grafana-datasource that referenced this issue Mar 30, 2018
... to prevent from adding quotes around resolved variables
@jotak
Copy link
Collaborator

jotak commented Mar 30, 2018

Sorry for the late response, I have been quite busy these weeks.
I've just proposed a solution here: #103

@viv816
Copy link
Author

viv816 commented Apr 2, 2018

Thank you very much.

I will try to pull the new image and inform you after my testing.

@apolegoshko
Copy link

+1 to this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants