QueryData method not triggered on Apply button click

  • What Grafana version and what operating system are you using?
    Grafana 9.2.5, Linux Ubuntu (WSL on Windows 10)

  • What are you trying to achieve?
    I have written my backend datasource plugin (with streaming) using the Grafana Plugin SDK for Go.

  • How are you trying to achieve it?
    I have implemented the QueryData, RunStream, SubscribeStream and PublishStream methods for both streaming and non-streaming data in my backend datasource plugin.

  • What happened?
    The QueryData method in my backend datasource does not trigger when the Apply button is clicked in the Edit Panel view specifically for the timeseries visualization for the first time (only). It straight goes to the View mode; but editing the panel again and then clicking Apply button for the second time triggers the QueryData method (which is weird). For other visualizations like Chart Panel this problem does not occur. Only for time-series it seems to skip QueryData method for the first time (only).

  • What did you expect to happen?
    I was expecting that the QueryData method will get triggered everytime you click the Apply button in edit panel mode.

  • Can you copy/paste the configuration(s) that you are having problems with?
    The below is my QueryData method. No problems with it and it works fine. Just that it does not get triggered when I click the Apply button for the first time (only) for timeseries visualization.

func (d *RMFClient) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {

// create queryDataResponse struct
queryDataResponse := backend.NewQueryDataResponse()

if len(req.Queries) == 0 {
	return queryDataResponse, nil
}

// loop over queries and execute them individually.
for _, q := range req.Queries {
	dataResponse := d.query(ctx, req.PluginContext, q)
	if dataResponse != nil {
		queryDataResponse.Responses[q.RefID] = *dataResponse
	}
}

return queryDataResponse, nil

}

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No errors.

  • Did you follow any online instructions? If so, what is the URL?
    NA

An issue is logged with the Grafana team in the below link →
Timeseries Plugin has an issue: QueryData method in backend plugin not triggered on Apply button click (first time) · Issue #72837 · grafana/grafana (github.com)

1 Like