Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EXPORTER] Error when grpc endpoint is empty #2507

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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