File tree Expand file tree Collapse file tree 3 files changed +20
-8
lines changed
include/opentelemetry/exporters/otlp Expand file tree Collapse file tree 3 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ class Arena;
3535}
3636} // namespace google
3737
38+ namespace grpc
39+ {
40+ class ChannelArguments ;
41+ } // namespace grpc
42+
3843namespace opentelemetry
3944{
4045namespace proto
@@ -256,8 +261,10 @@ class OtlpGrpcClient
256261private:
257262 friend class OtlpGrpcClientTestPeer ;
258263
259- // Build gRPC channel arguments from exporter options. Shared by MakeChannel() and unit tests.
260- static grpc::ChannelArguments BuildChannelArguments (const OtlpGrpcClientOptions &options);
264+ // Populate gRPC channel arguments from exporter options. Shared by MakeChannel() and unit
265+ // tests.
266+ static void PopulateChannelArguments (const OtlpGrpcClientOptions &options,
267+ grpc::ChannelArguments &grpc_arguments);
261268
262269 // Stores if this gRPC client had its Shutdown() method called
263270 std::atomic<bool > is_shutdown_;
Original file line number Diff line number Diff line change @@ -355,7 +355,8 @@ std::shared_ptr<grpc::Channel> OtlpGrpcClient::MakeChannel(const OtlpGrpcClientO
355355 return nullptr ;
356356 }
357357
358- grpc::ChannelArguments grpc_arguments = BuildChannelArguments (options);
358+ grpc::ChannelArguments grpc_arguments;
359+ PopulateChannelArguments (options, grpc_arguments);
359360
360361 if (options.use_ssl_credentials )
361362 {
@@ -394,9 +395,11 @@ std::shared_ptr<grpc::Channel> OtlpGrpcClient::MakeChannel(const OtlpGrpcClientO
394395 return channel;
395396}
396397
397- grpc::ChannelArguments OtlpGrpcClient::BuildChannelArguments (const OtlpGrpcClientOptions &options)
398+ void OtlpGrpcClient::PopulateChannelArguments (const OtlpGrpcClientOptions &options,
399+ grpc::ChannelArguments &grpc_arguments)
398400{
399- grpc::ChannelArguments grpc_arguments;
401+ grpc_arguments = grpc::ChannelArguments{};
402+
400403 if (options.channel_arguments != nullptr )
401404 {
402405 grpc_arguments = *options.channel_arguments ;
@@ -455,8 +458,6 @@ grpc::ChannelArguments OtlpGrpcClient::BuildChannelArguments(const OtlpGrpcClien
455458 grpc_arguments.SetServiceConfigJSON (service_config);
456459 }
457460#endif // ENABLE_OTLP_RETRY_PREVIEW
458-
459- return grpc_arguments;
460461}
461462
462463std::unique_ptr<grpc::ClientContext> OtlpGrpcClient::MakeClientContext (
Original file line number Diff line number Diff line change 11// Copyright The OpenTelemetry Authors
22// SPDX-License-Identifier: Apache-2.0
33
4+ #include < grpc/grpc.h>
45#include < grpcpp/support/channel_arguments.h>
56#include < gtest/gtest.h>
67
78#include < cstring>
9+ #include < string>
810
911#include " opentelemetry/exporters/otlp/otlp_grpc_client.h"
1012#include " opentelemetry/exporters/otlp/otlp_grpc_client_options.h"
@@ -40,7 +42,9 @@ class OtlpGrpcClientTestPeer : public ::testing::Test
4042public:
4143 static grpc::ChannelArguments BuildChannelArguments (const OtlpGrpcClientOptions &options)
4244 {
43- return OtlpGrpcClient::BuildChannelArguments (options);
45+ grpc::ChannelArguments grpc_arguments;
46+ OtlpGrpcClient::PopulateChannelArguments (options, grpc_arguments);
47+ return grpc_arguments;
4448 }
4549};
4650
You can’t perform that action at this time.
0 commit comments