I am using the JSON API data source plugin (version 1.3.2, due to Grafana version 7.5.12) to call a custom API that returns a time series, and am displaying this series in a bar chart.
The basic case works fine: I issue one API call, retrieve one time series and display it in the chart. Works fine.
But what I really want is a stacked bar chart – I want to retrieve 4 time series and display them stacked. The API can just return one time series, but takes a parameter in to select the wanted time series. So in the barchart I created 4 queries against the same API endpoint, passing in a different parameter in the four cases.
The problem is that with this approach, the Grafana behavior is quite unpredictable. Sometimes I get the correct result shown below (only two of the four time series have data for the selected interval):
while other times the chart may display just one of the time series, or may display 3 or 4 stacked time series using data from one of the two time series that contain data. Like here, where one of the time series is repeated for all 4 stacked values:
I have tested the API carefully with single calls from Postman and Grafana, and it returns the correct data for the given parameters. So this issue seems only to appear when there are multiple calls to the same API endpoint triggered simultaneously from Grafana.
I can reproduce this in the plugin configuration: If I disable all four queries and just have one of them enabled at a time, this displays the correct data. But if I enable two or more, results vary in what to me seems like an unpredictable manner.
What I am overlooking? Will be happy to submit more info/examples if needed.
I am using the JSON API data source plugin (version 1.3.2, due to Grafana version 7.5.12) to call a custom API that returns a time series, and am displaying this series in a bar chart.
The basic case works fine: I issue one API call, retrieve one time series and display it in the chart. Works fine.
But what I really want is a stacked bar chart – I want to retrieve 4 time series and display them stacked. The API can just return one time series, but takes a parameter in to select the wanted time series. So in the barchart I created 4 queries against the same API endpoint, passing in a different parameter in the four cases.
The problem is that with this approach, the Grafana behavior is quite unpredictable. Sometimes I get the correct result shown below (only two of the four time series have data for the selected interval):
while other times the chart may display just one of the time series, or may display 3 or 4 stacked time series using data from one of the two time series that contain data. Like here, where one of the time series is repeated for all 4 stacked values:
I have tested the API carefully with single calls from Postman and Grafana, and it returns the correct data for the given parameters. So this issue seems only to appear when there are multiple calls to the same API endpoint triggered simultaneously from Grafana.
I can reproduce this in the plugin configuration: If I disable all four queries and just have one of them enabled at a time, this displays the correct data. But if I enable two or more, results vary in what to me seems like an unpredictable manner.
What I am overlooking? Will be happy to submit more info/examples if needed.