Skip to content

Formatting of multi-valued variables fails #149

@otaconix

Description

@otaconix

I'm trying to use a query-typed dashboard variable, for which the datasource plugin has a custom formatting function. Unfortunately, the formatting function attempts to find the name of the field the variable is for (in order to be able to construct a query of the form field:value1 OR field:value2 ...), and in doing so, it runs into a runtime error, because it attempts to lookup a field on the variable which is undefined.

Screenshot of the variable definition:

Image

Screenshot of Firefox debugger to show where it goes wrong:

Image

Message in Firefox console:

PanelQueryRunner Error SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
    Ue base.ts:371
    we sceneInterpolator.js:59
    on sceneInterpolator.js:24
    on sceneInterpolator.js:14
    Mc sceneGraph.js:31
    replace template_srv.ts:264
    interpolateLuceneQuery base.ts:312
    applyTemplateVariables base.ts:343
    K DataSourceWithBackend.ts:178
    query DataSourceWithBackend.ts:141
    query base.ts:87
    F runRequest.ts:239
    U runRequest.ts:200
    I runRequest.ts:146
    runWithTimeRangeAndScopes SceneQueryRunner.js:322
    _timeSub SceneQueryRunner.js:261
    subscribeToState SceneObjectBase.js:80
    RxJS 3
    c EventBus.ts:39
    emit index.js:202
    publish EventBus.ts:29
    publishEvent SceneObjectBase.js:166
    setState SceneObjectBase.js:99
    refreshRange SceneTimeRange.js:137
    onRefresh SceneTimeRange.js:62
    onRefresh SceneRefreshPicker.js:43
    onRefresh SceneRefreshPicker.js:169
    React 11
SceneQueryRunner.js:338:14

Extra information

  • Grafana version: v11.6.1 (ae23ead4d9)
  • Quickwit datasource version: 0.4.5

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions