grafana-timelion-datasource icon indicating copy to clipboard operation
grafana-timelion-datasource copied to clipboard

Fixing multiple parameters to use Lucene format

Open mateczagany opened this issue 6 years ago • 3 comments

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 avatar Nov 29 '18 13:11 mateczagany

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.

mateczagany avatar Nov 30 '18 09:11 mateczagany

@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

gbrian avatar Nov 30 '18 10:11 gbrian

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 *

mateczagany avatar Nov 30 '18 12:11 mateczagany