Plot multiple timeseries using single JSONPath on JSON string coming from WebSocket Datasource Plugin

What should be
a) the structure of the JSON string coming from WebSocket data source plugin and
b) the JSONPath in the field for query
such that a single JSONPath in the field leads to multiple separate timeseries curves?

For example, if a JSON is created as below
{ "book": [ { "value01":3}, { "value02": 32}, ... ], "timestamp":"2022-07-14T10:56:48Z"}
what should be the single JSONPath in the field to plot value01 and value02 as points on two separate curves on the same panel? The values share a common timestamp.

Note: There could be many value<xy> keys instead of just the two. The intent here is to avoid creating new fields to explicitly query each parameter/key. Please feel free to propose a better arrangement of values within the JSON string. Thank you.

Environment: Grafana v9.0.0 on Windows10


tough one but if you are able to use jsonata and convert your data to

        'metric' :     $keys($), 
        'value' : $.*,
        'time': $$.timestamp

will do it. play with it, there might be better ways.

		"name": "value01",
		"value": 3,
		"time": "2022-07-14T10:56:48Z"
		"name": "value02",
		"value": 32,
		"time": "2022-07-14T10:56:48Z"
		"name": "value03",
		"value": 13,
		"time": "2022-07-14T10:56:48Z"

1 Like

I am able to use only JSONPath in the current version of WebSocket plugin. I had hoped there would be a method using Grafana variables. In absence of other solutions, your response is the closest to a solution (which might work in the future).