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

[configgrpc] wrap gRPC client/server options in extensible interface #11069

Merged

Conversation

jade-guiton-dd
Copy link
Contributor

@jade-guiton-dd jade-guiton-dd commented Sep 6, 2024

Description

To allow extending the possible option types provided to configgrpc.ClientConfig.ToClientConn and configgrpc.ServerConfig.ToServer in the future, we want to wrap the grpc.DialOption and grpc.ServerOption parameters in more generic ToClientConnOption and ToServerOption interfaces.

For compatibility, we start by adding new ToClientConnWithOptions and ToServerWithOptions methods, to which the now deprecated ToClientConn and ToServer defer. A second PR will be needed to fully replace the original methods.

Link to tracking issue

Fixes #9480

Testing

No tests have been added. Feel free to tell me if I should add some.

Documentation

No documentation has been added.

Copy link

linux-foundation-easycla bot commented Sep 6, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

codecov bot commented Sep 6, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 6 lines in your changes missing coverage. Please review.

Project coverage is 91.87%. Comparing base (396ae85) to head (792a14f).

Files with missing lines Patch % Lines
config/configgrpc/configgrpc.go 80.00% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11069      +/-   ##
==========================================
- Coverage   91.89%   91.87%   -0.03%     
==========================================
  Files         416      416              
  Lines       19911    19932      +21     
==========================================
+ Hits        18297    18312      +15     
- Misses       1239     1243       +4     
- Partials      375      377       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jade-guiton-dd jade-guiton-dd marked this pull request as ready for review September 6, 2024 14:49
@jade-guiton-dd jade-guiton-dd requested review from a team and djaglowski September 6, 2024 14:49
Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

Thanks @jade-guiton-dd for taking this on! some initial comments

config/configgrpc/configgrpc.go Outdated Show resolved Hide resolved
config/configgrpc/configgrpc.go Show resolved Hide resolved
config/configgrpc/configgrpc.go Show resolved Hide resolved
config/configgrpc/configgrpc.go Show resolved Hide resolved
config/configgrpc/configgrpc.go Show resolved Hide resolved
@jade-guiton-dd
Copy link
Contributor Author

jade-guiton-dd commented Sep 10, 2024

I applied your suggestions, and added some clickable links in my doc comments while I was at it. Feel free to tell me if there are remaining issues.

Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

Looks like you need to update the ToClientConn used here:

if e.clientConn, err = e.config.ClientConfig.ToClientConn(ctx, host, e.settings, grpc.WithUserAgent(e.userAgent)); err != nil {
to make CI pass

config/configgrpc/configgrpc.go Outdated Show resolved Hide resolved
config/configgrpc/configgrpc.go Outdated Show resolved Hide resolved
config/configgrpc/configgrpc.go Outdated Show resolved Hide resolved
config/configgrpc/configgrpc.go Outdated Show resolved Hide resolved
config/configgrpc/configgrpc.go Outdated Show resolved Hide resolved
config/configgrpc/configgrpc.go Outdated Show resolved Hide resolved
config/configgrpc/configgrpc.go Outdated Show resolved Hide resolved
Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
@mx-psi
Copy link
Member

mx-psi commented Sep 19, 2024

@codeboten will merge this tomorrow unless you have further comments

@jade-guiton-dd jade-guiton-dd requested a review from a team as a code owner September 19, 2024 10:42
@codeboten codeboten merged commit 459b429 into open-telemetry:main Sep 19, 2024
46 of 47 checks passed
@github-actions github-actions bot added this to the next release milestone Sep 19, 2024
bogdandrutu pushed a commit that referenced this pull request Sep 27, 2024
#11271)

#### Description

`ClientConfig.ToClientConn` and `ServerConfig.ToServer` were deprecated
in v0.110.0 in favor of `ClientConfig.ToClientConnWithOptions` and
`ServerConfig.ToServerWithOptions` which use a more flexible option type
(#11069). The original functions are now removed, and the new ones are
renamed to the old names. The `WithOptions` names are kept as deprecated
aliases for now.

Note: The "4 lines missing coverage" are from the `WithOptions` function
aliases.

#### Link to tracking issue
Updates #9480

#### Next steps

- `collector-contrib` will need to be updated to rename uses of the
`WithOptions` functions
- The newly deprecated aliases will then need to be removed in the next
release
jackgopack4 pushed a commit to jackgopack4/opentelemetry-collector that referenced this pull request Oct 8, 2024
open-telemetry#11271)

#### Description

`ClientConfig.ToClientConn` and `ServerConfig.ToServer` were deprecated
in v0.110.0 in favor of `ClientConfig.ToClientConnWithOptions` and
`ServerConfig.ToServerWithOptions` which use a more flexible option type
(open-telemetry#11069). The original functions are now removed, and the new ones are
renamed to the old names. The `WithOptions` names are kept as deprecated
aliases for now.

Note: The "4 lines missing coverage" are from the `WithOptions` function
aliases.

#### Link to tracking issue
Updates open-telemetry#9480

#### Next steps

- `collector-contrib` will need to be updated to rename uses of the
`WithOptions` functions
- The newly deprecated aliases will then need to be removed in the next
release
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.

[configrpc] Consider adding option wrapper on ToServer and ToClientConn
4 participants