Skip to content

Commit

Permalink
[EXPORTER] Error when grpc endpoint is empty (#2507)
Browse files Browse the repository at this point in the history
  • Loading branch information
HennerM authored Feb 23, 2024
1 parent 4eb99f9 commit 9649ebe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion exporters/otlp/src/otlp_grpc_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,13 @@ OtlpGrpcClient::~OtlpGrpcClient()

std::shared_ptr<grpc::Channel> OtlpGrpcClient::MakeChannel(const OtlpGrpcClientOptions &options)
{
std::shared_ptr<grpc::Channel> channel;

if (options.endpoint.empty())
{
OTEL_INTERNAL_LOG_ERROR("[OTLP GRPC Client] empty endpoint");

return nullptr;
}
//
// Scheme is allowed in OTLP endpoint definition, but is not allowed for creating gRPC
// channel. Passing URI with scheme to grpc::CreateChannel could resolve the endpoint to some
Expand All @@ -280,6 +285,7 @@ std::shared_ptr<grpc::Channel> OtlpGrpcClient::MakeChannel(const OtlpGrpcClientO
return nullptr;
}

std::shared_ptr<grpc::Channel> channel;
std::string grpc_target = url.host_ + ":" + std::to_string(static_cast<int>(url.port_));
grpc::ChannelArguments grpc_arguments;
grpc_arguments.SetUserAgentPrefix(options.user_agent);
Expand Down

1 comment on commit 9649ebe

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp sdk Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 9649ebe Previous: 4eb99f9 Ratio
BM_SumAggregation 9319431.641522575 ns/iter 4246516.661210493 ns/iter 2.19

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.