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

Fixing multiple parameters to use Lucene format #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mateczagany
Copy link

Hi Brian,

We had problems with substituting Grafana variables into Lucene queries.
Example parametrized Lucene query: .es(index=pageview_*,metric='sum:value',timefield='timestamp',q='platform: $PLATFORM').label('Current')

Without the fix it was substituted as:
.es(index=pageview_*,metric='sum:value',timefield='timestamp',q='platform: {Android,Windows,iOS}').label('Current')
which is not a valid Lucene query

After the fix:
.es(index=pageview_*,metric='sum:value',timefield='timestamp',q='platform: ("Android" OR "Windows" OR "iOS")').label('Current')
Which is what we want

Would you be so kind to merge this?

Regards,
Máté

@mateczagany
Copy link
Author

Hi,

We have also encountered a bug where the substitution of variables don't work when using breakdown panels and fixed it the same way.

@gbrian
Copy link
Owner

gbrian commented Nov 30, 2018

@czmate10 sorry for the delay. Question why not using:
'platform: ${PLATFORM:lucene}' instead 'platform: $PLATFORM' is same behavior and grafana's standard.
If we force globally this lucene type replacement it becomes more rigit, don't you?
I'm testing/checking your changes BTW

@mateczagany
Copy link
Author

mateczagany commented Nov 30, 2018

Hi @gbrian
You are correct, I didn't know about that advanced formatting, it really did solve my issue.
However it didn't solve the problem we have with breakdown panels (see 53e749a )

It seems to always replace the variable with *

In case of a breakdown panel, if I type $PLATFORM, it replaces it, but not with Lucene formatting
But if I type ${PLATFORM:lucene} or anything that is not exactly $PLATFORM it will replace it with *

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

Successfully merging this pull request may close these issues.

2 participants