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

protoc: Change protoc to include static method call option #6960

Merged
merged 5 commits into from
Mar 21, 2024

Conversation

zasweq
Copy link
Contributor

@zasweq zasweq commented Feb 2, 2024

This PR changes protoc to include generated call option. This will be used in stats handlers. This cannot be merged until gRPC is released with #6926, and we will have to update the minimum version of gRPC required for new versions of protoc-gen-go, and features which use this will need to regenerate their protos (such as Envoy's protos). Per offline discussion, OpenTelemetry e2e testing will be sufficient enough for testing this feature, as protoc-gen-go is implicitly tested in our tests which all use generated code from protoc-gen-go.

RELEASE NOTES:

  • protoc: Change protoc to include static method call option

@zasweq zasweq requested a review from dfawley February 2, 2024 00:44
@zasweq zasweq added the Type: Feature New features or improvements in behavior label Feb 2, 2024
@zasweq zasweq added this to the 1.62 Release milestone Feb 2, 2024
Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Merging #6960 (a7f09fb) into master (84b85ba) will decrease coverage by 1.19%.
Report is 41 commits behind head on master.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6960      +/-   ##
==========================================
- Coverage   83.72%   82.53%   -1.19%     
==========================================
  Files         287      300      +13     
  Lines       30915    31351     +436     
==========================================
- Hits        25884    25876       -8     
- Misses       3969     4422     +453     
+ Partials     1062     1053       -9     

see 70 files with indirect coverage changes

Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

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

LGTM with one nit. But also blocked on the next gRPC release.

@@ -170,7 +170,7 @@ func generateFileContent(gen *protogen.Plugin, file *protogen.File, g *protogen.

g.P("// This is a compile-time assertion to ensure that this generated file")
g.P("// is compatible with the grpc package it is being compiled against.")
g.P("// Requires gRPC-Go v1.32.0 or later.")
g.P("// Requires gRPC-Go v1.32.0 or later.") // TODO: Update to latest released gRPC version
g.P("const _ = ", grpcPackage.Ident("SupportPackageIsVersion7")) // When changing, update version number above.
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be updated to Version8 now. The comment just lets users discover more easily when Version8 became available.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment on lines 312 to 316
g.P("cOpts := make([]", grpcPackage.Ident("CallOption"), ", len(opts))")
g.P("for i, opt := range opts {")
g.P(" cOpts[i] = opt")
g.P("}")
g.P("cOpts = append(cOpts, ", grpcPackage.Ident("RegisteredMethod()"), "\"")
Copy link
Member

Choose a reason for hiding this comment

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

Can be simplified to:

opts := append([]CallOption{grpc.RegisteredMethod()}, opts...) // shadows `opts` so you don't need the subsequent diffs even

Or use copy instead of a loop (and also pre-allocate len(opts)+1).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to former. Chose that since less lines of code and get rid of subsequent diffs.

@dfawley dfawley assigned zasweq and unassigned dfawley Feb 5, 2024
@zasweq
Copy link
Contributor Author

zasweq commented Feb 5, 2024

Finished comments, as discussed offline, let's run this by Eric to see if we even want to go down this route, or if we should preregister on ClientConn.

@zasweq
Copy link
Contributor Author

zasweq commented Feb 5, 2024

Also cannot merge until 1.62 release.

@ginayeh ginayeh modified the milestones: 1.62 Release, 1.63 Release Feb 8, 2024
@zasweq zasweq assigned dfawley and unassigned zasweq Feb 14, 2024
@dfawley dfawley removed their assignment Feb 16, 2024
@arvindbr8 arvindbr8 closed this Feb 28, 2024
@zasweq zasweq reopened this Mar 18, 2024
@zasweq
Copy link
Contributor Author

zasweq commented Mar 18, 2024

Reopened this since I think this is ready to be merged as the release is out.

Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

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

Please regenerate all the protos and make sure vet-proto is green before merging.

@zasweq zasweq merged commit eb5828b into grpc:master Mar 21, 2024
14 checks passed
@zasweq zasweq changed the title protoc: Change protoc to include generated call option protoc: Change protoc to include static method call option Mar 21, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Feature New features or improvements in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants