Skip to content

Commit

Permalink
Switch away from initializer lists because Windows complains. Also add
Browse files Browse the repository at this point in the history
"SSL" to the mTLS macros since evenetually there will be something named
TLS on the gRPC side.
  • Loading branch information
kylepl committed Jun 22, 2023
1 parent 933e6c0 commit 6245fcd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ if(WITH_OTLP_HTTP_SSL_PREVIEW)
endif()
endif()

if (WITH_OTLP_GRPC_MTLS_PREVIEW)
if (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_OTLP_GRPC_MTLS_PREVIEW)
INTERFACE ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW)
endif()

if(WITH_METRICS_EXEMPLAR_PREVIEW)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct OtlpGrpcExporterOptions
// SSL encryption.
std::string ssl_credentials_cacert_as_string = GetOtlpDefaultSslCertificateString();

#ifdef ENABLE_OTLP_GRPC_MTLS_PREVIEW
#ifdef ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW
// At most one of ssl_client_key_* should be non-empty. If use_ssl_credentials, they will
// be read to allow for mTLS.
std::string ssl_client_key_path = GetOtlpDefaultTracesSslClientKeyPath();
Expand Down
22 changes: 11 additions & 11 deletions exporters/otlp/src/otlp_grpc_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ std::shared_ptr<grpc::Channel> OtlpGrpcClient::MakeChannel(const OtlpGrpcExporte
grpc_arguments.SetUserAgentPrefix(options.user_agent);

if (options.use_ssl_credentials) {
grpc::SslCredentialsOptions ssl_opts = {
.pem_root_certs = GetFileContentsOrInMemoryContents(
options.ssl_credentials_cacert_path,
options.ssl_credentials_cacert_as_string),
#if ENABLE_OTLP_GRPC_MTLS_PREVIEW
.pem_private_key = GetFileContentsOrInMemoryContents(
options.ssl_client_key_path,
options.ssl_client_key_string),
.pem_cert_chain = GetFileContentsOrInMemoryContents(
options.ssl_client_cert_path,
options.ssl_client_cert_string)
grpc::SslCredentialsOptions ssl_opts;
ssl_opts.pem_root_certs = GetFileContentsOrInMemoryContents(
options.ssl_credentials_cacert_path,
options.ssl_credentials_cacert_as_string);
#if ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW
ssl_opts.pem_private_key = GetFileContentsOrInMemoryContents(
options.ssl_client_key_path,
options.ssl_client_key_string);
ssl_opts.pem_cert_chain = GetFileContentsOrInMemoryContents(
options.ssl_client_cert_path,
options.ssl_client_cert_string);
#endif
};
channel =
Expand Down

0 comments on commit 6245fcd

Please sign in to comment.