Allow user use custom grpc::ChannelArguments#3990
Allow user use custom grpc::ChannelArguments#3990owent wants to merge 3 commits intoopen-telemetry:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the OTLP gRPC exporter/client configuration to allow callers to supply custom grpc::ChannelArguments, enabling advanced gRPC tuning (e.g., disabling HTTP proxy handling to avoid getenv-related races) while preserving existing option-derived defaults.
Changes:
- Add
channel_argumentstoOtlpGrpcClientOptionsand copy caller-provided arguments into the channel configuration. - Refactor channel-argument construction into
OtlpGrpcClient::BuildChannelArguments()and reuse it fromMakeChannel(). - Add a unit test validating that caller-provided channel arguments are copied and that user-agent configuration is applied.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client_options.h | Adds a new options field for passing custom gRPC channel arguments. |
| exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client.h | Adds an internal helper for building channel arguments (used by implementation + tests). |
| exporters/otlp/src/otlp_grpc_client.cc | Implements copying of caller-provided channel arguments and refactors channel argument construction. |
| exporters/otlp/test/otlp_grpc_target_test.cc | Adds coverage to verify channel-argument copying and user-agent behavior. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3990 +/- ##
==========================================
- Coverage 90.37% 90.33% -0.04%
==========================================
Files 230 230
Lines 7298 7298
==========================================
- Hits 6595 6592 -3
- Misses 703 706 +3 🚀 New features to boost your workflow:
|
714b895 to
cc58164
Compare
| * This is a non-owning pointer, and the pointed-to arguments are copied when the channel is | ||
| * created. | ||
| */ | ||
| const grpc::ChannelArguments *channel_arguments{}; |
There was a problem hiding this comment.
nit - Question: can we make the lifetime requirement a bit more explicit here? Something like:
/*
This is a non-owning pointer; the pointed-to grpc::ChannelArguments must remain valid until client/channel construction copies it.
*/Currently, "Copied when the channel is created" is directionally right, but it still leaves the required lifetime a little ambiguous.
There was a problem hiding this comment.
I’m not a native English speaker. Could you please review the changes to see if it’s clearer?
aaa63bc to
aecc4f4
Compare
Fixes #3883
Changes
grpc::ChannelArgumentswith SDK.For significant contributions please make sure you have completed the following items:
CHANGELOG.mdupdated for non-trivial changes