Skip to content

Allow user use custom grpc::ChannelArguments#3990

Open
owent wants to merge 4 commits intoopen-telemetry:mainfrom
owent:allow_custom_ChannelArguments_for_grpc_exporters
Open

Allow user use custom grpc::ChannelArguments#3990
owent wants to merge 4 commits intoopen-telemetry:mainfrom
owent:allow_custom_ChannelArguments_for_grpc_exporters

Conversation

@owent
Copy link
Copy Markdown
Member

@owent owent commented Apr 12, 2026

Fixes #3883

Changes

  • Allow users to use custom grpc::ChannelArguments with SDK.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

Copilot AI review requested due to automatic review settings April 12, 2026 11:12
@owent owent requested a review from a team as a code owner April 12, 2026 11:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_arguments to OtlpGrpcClientOptions and copy caller-provided arguments into the channel configuration.
  • Refactor channel-argument construction into OtlpGrpcClient::BuildChannelArguments() and reuse it from MakeChannel().
  • 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
Copy link
Copy Markdown

codecov bot commented Apr 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.33%. Comparing base (0962d71) to head (aaa63bc).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3990      +/-   ##
==========================================
+ Coverage   90.32%   90.33%   +0.02%     
==========================================
  Files         230      230              
  Lines        7299     7299              
==========================================
+ Hits         6592     6593       +1     
+ Misses        707      706       -1     

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@owent owent force-pushed the allow_custom_ChannelArguments_for_grpc_exporters branch from 1daae04 to 714b895 Compare April 12, 2026 12:24
@owent owent force-pushed the allow_custom_ChannelArguments_for_grpc_exporters branch from 714b895 to cc58164 Compare April 12, 2026 15:59
void OtlpGrpcClient::PopulateChannelArguments(const OtlpGrpcClientOptions &options,
grpc::ChannelArguments &grpc_arguments)
{
grpc_arguments = grpc::ChannelArguments{};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems redundant because it is already default initialized.

* This is a non-owning pointer, and the pointed-to arguments are copied when the channel is
* created.
*/
const grpc::ChannelArguments *channel_arguments{};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

LGTM. nit comments.

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.

SIGSEGV in OtlpGrpcClient::MakeChannel

4 participants