Skip to content

QueryData: Support JSON format response#1491

Merged
ryantxu merged 4 commits intomainfrom
support-json-in-query-data
Feb 27, 2026
Merged

QueryData: Support JSON format response#1491
ryantxu merged 4 commits intomainfrom
support-json-in-query-data

Conversation

@ryantxu
Copy link
Contributor

@ryantxu ryantxu commented Feb 21, 2026

Similar to #1486, this allows clients to request JSON bytes from QueryData

This includes a breaking change inside the internal ConvertToProtobuf utility. Given that this is an internal utility marked:

This is used internally by the SDK and inside Grafana-server, plugin authors should not need this functionality.

In grafana/grafana#118223, this will allow every datasource to efficiently implement direct-to-browser chunking without changing any code

// It will set the RefID on the frames to the RefID key in Responses if a Frame's
// RefId property is an empty string.
func (t ConvertToProtobuf) QueryDataResponse(res *QueryDataResponse) (*pluginv2.QueryDataResponse, error) {
func (t ConvertToProtobuf) QueryDataResponse(format DataFrameFormat, res *QueryDataResponse) (*pluginv2.QueryDataResponse, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a breaking change!

We could avoid it by adding a new function and defaulting to arrow -- but this is kind of internal, and if anyone is calling it directly we would like them to consider the new request parameter also 😏

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one option to avoid breaking changes might be to make this optional by moving to the second arg and using ...DataFrameFormat. that always feels a bit sketchy to me though. thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scratch that, @wbrowne mentioned in slack that it's only used in the SDK, which i missed

@grafana-plugins-platform-bot grafana-plugins-platform-bot bot moved this from 📬 Triage to 🔬 In review in Grafana Catalog Team Feb 23, 2026
@ryantxu ryantxu marked this pull request as ready for review February 23, 2026 09:38
@ryantxu ryantxu requested a review from a team as a code owner February 23, 2026 09:38
@ryantxu ryantxu requested a review from dgiagio February 24, 2026 07:24
return
}

respJSON, err := tpQueryData.Client.QueryData(ctx, &backend.QueryDataRequest{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensures that the JSON response format matches the otheres

Copy link
Contributor

@dgiagio dgiagio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ryantxu ryantxu merged commit 257acb1 into main Feb 27, 2026
9 of 10 checks passed
@ryantxu ryantxu deleted the support-json-in-query-data branch February 27, 2026 06:12
@github-project-automation github-project-automation bot moved this from 🔬 In review to 🚀 Shipped in Grafana Catalog Team Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants