From b3b4f1256cee6211a39ea891c73daa9fdef45407 Mon Sep 17 00:00:00 2001 From: Kyle Loveless Date: Wed, 3 May 2023 09:41:19 -0400 Subject: [PATCH] Switch to absl options/variant to support earlier C++. --- .../exporters/otlp/otlp_grpc_exporter_options.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h index cf23cedb9a..7195289413 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h @@ -3,12 +3,11 @@ #pragma once +#include "absl/types/optional.h" +#include "absl/types/variant.h" #include "opentelemetry/exporters/otlp/otlp_environment.h" #include -// TODO: These requires C++17, is that OK? It seems like we need to support C++0x? -#include -#include OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -17,7 +16,7 @@ namespace otlp { // This type allows the variants to be default-constructed to neither type. -// This avoids needing deeper template if std::optional>. +// This avoids needing deeper template if absl::optional>. struct Unset {}; // TODO: Check if this strong-typing is ok. It seems nice, and allows variant typing. @@ -35,13 +34,13 @@ struct FileContents { struct SSLCredentials { // Path to or contents of a .pem file of the root certs used to verify the service side // certificate. - std::variant pem_root_certs; + absl::variant pem_root_certs; // Path to or contents of a .pem file containing the client's private key. - std::variant pem_private_key; + absl::variant pem_private_key; // Path to or contents of a .pem file containing the client's certificate chain. - std::variant pem_cert_chain; + absl::variant pem_cert_chain; }; /** @@ -61,7 +60,7 @@ struct OtlpGrpcExporterOptions // SSL encryption. std::string ssl_credentials_cacert_as_string = GetOtlpDefaultSslCertificateString(); // The credentials to secure the connection. - std::optional ssl_credentials; + absl::optional ssl_credentials; // Timeout for grpc deadline std::chrono::system_clock::duration timeout = GetOtlpDefaultTimeout(); // Additional HTTP headers