Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove apiVersion from root PluginContext #1015

Closed
wants to merge 3 commits into from
Closed

Conversation

andresmgot
Copy link
Contributor

@andresmgot andresmgot commented Jul 2, 2024

What this PR does / why we need it:

Continue clean up from grafana/grafana#89830. The apiVersion is set as part of the DatasourceInstanceSettings so it does not need / should not be directly in the PluginContext struct. This was removed in grafana/grafana here: https://github.com/grafana/grafana/pull/89831/files#diff-663e8e1a8cdfbbf4d139f9d2cdd32681687fbe625e79d02d08e69a03519c71f5L46

This is marked as a breaking change (both for removing the field from the proto and the struct) but since it was not being used it should be fine. Let me know if you disagree.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

@andresmgot andresmgot marked this pull request as ready for review July 2, 2024 13:46
@andresmgot andresmgot requested a review from a team as a code owner July 2, 2024 13:46
@andresmgot andresmgot requested review from wbrowne, marefr, oshirohugo and ryantxu and removed request for a team July 2, 2024 13:46
@@ -81,9 +81,6 @@ message PluginContext {

// The user agent of the Grafana server that initiated the gRPC request.
string userAgent = 8;

// The API version that initiated a request
string apiVersion = 9;
Copy link
Contributor

Choose a reason for hiding this comment

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

Sure this is fine even though not in use? Have you tested it? Like if a new field 9 is added later with a different type and there are grafana/plugin versions still depending on the old version etc. You never delete anything is what I've learned. I think there's a trick to keep the index unnamed or something

@@ -81,9 +81,6 @@ message PluginContext {

// The user agent of the Grafana server that initiated the gRPC request.
string userAgent = 8;

// The API version that initiated a request
string apiVersion = 9;
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why this should be removed. Any requests starting from apiservers should include it. This is how the backend can consistently know the apiversion for all grpc requests

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 bit fuzzy to me, the apiservers don't start requests, do they? Meaning, the request comes from either a frontend, the alert runner or similar. Why would it append an api version to a request it's receiving?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment made offline by @marefr:

Okay. But datasource api server receiving a request will have the api version in the URL and to route that to backend plugin handling that specific api version you might need to forward the api version 🤷 In that case, plugin context seems like a good fit. That's my thinking

Which makes sense. Thanks both for the input!

We are not using this atm but yeah, we may want to use it. I'll close this PR 👍

@andresmgot andresmgot closed this Jul 3, 2024
@wbrowne wbrowne deleted the apiVersionPctx branch July 4, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants