Skip to content

[OTLP GRPC] Allow user use custom grpc::ChannelArguments - #3990

Merged
marcalff merged 6 commits into
open-telemetry:mainfrom
owent:allow_custom_ChannelArguments_for_grpc_exporters
Apr 21, 2026
Merged

marcalff merged 6 commits into
open-telemetry:mainfrom
owent:allow_custom_ChannelArguments_for_grpc_exporters

Conversation

@owent

@owent owent commented Apr 12, 2026 •

Copy link
Copy Markdown
Member

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

Copilot AI left a comment

Copy link
Copy Markdown

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

codecov Bot commented Apr 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.83%. Comparing base (e4aea65) to head (c60034f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
exporters/otlp/src/otlp_grpc_client.cc 85.72% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3990      +/-   ##
==========================================
+ Coverage   81.82%   81.83%   +0.01%     
==========================================
  Files         374      374              
  Lines       15771    15776       +5     
==========================================
+ Hits        12903    12908       +5     
  Misses       2868     2868              
Files with missing lines Coverage Δ
...elemetry/exporters/otlp/otlp_grpc_client_options.h 100.00% <ø> (ø)
exporters/otlp/src/otlp_grpc_client.cc 71.53% <85.72%> (+0.51%) ⬆️
🚀 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 2 times, most recently from 714b895 to cc58164 Compare April 12, 2026 15:59
Comment thread exporters/otlp/src/otlp_grpc_client.cc Resolved
* 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 Author

Choose a reason for hiding this comment

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

I’m not a native English speaker. Could you please review the changes to see if it’s clearer?

@lalitb lalitb left a comment

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.

LGTM. nit comments.

@owent
owent force-pushed the allow_custom_ChannelArguments_for_grpc_exporters branch from aaa63bc to aecc4f4 Compare April 18, 2026 11:31
@marcalff
marcalff merged commit e511f6e into open-telemetry:main Apr 21, 2026
68 checks passed
@marcalff marcalff changed the title Allow user use custom grpc::ChannelArguments [OTLP GRPC] Allow user use custom grpc::ChannelArguments Apr 21, 2026
@owent
owent deleted the allow_custom_ChannelArguments_for_grpc_exporters branch June 14, 2026 13:07
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

5 participants