Skip to content

Commit

Permalink
Merge branch 'zipkin-kind' of github.com:lalitb/opentelemetry-cpp int…
Browse files Browse the repository at this point in the history
…o zipkin-kind
  • Loading branch information
lalitb committed Apr 27, 2021
2 parents 1b4594d + 8af42e2 commit 7e114fc
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,23 @@ const char *kZipkinEndpointDefault = "http://localhost:9411/api/v2/spans";

static const std::string GetDefaultZipkinEndpoint()
{
auto endpoint_from_env = std::getenv("OTEL_EXPORTER_ZIPKIN_ENDPOINT");
const char *otel_exporter_zipkin_endpoint_env = "OTEL_EXPORTER_ZIPKIN_ENDPOINT";
#if defined(_MSC_VER)
// avoid calling std::getenv which is deprecated in MSVC.
size_t required_size = 0;
getenv_s(&required_size, nullptr, 0, otel_exporter_zipkin_endpoint_env);
const char *endpoint_from_env = nullptr;
std::unique_ptr<char> endpoint_buffer;
if (required_size > 0)
{
endpoint_buffer = std::unique_ptr<char>{new char[required_size]};
getenv_s(&required_size, endpoint_buffer.get(), required_size,
otel_exporter_zipkin_endpoint_env);
endpoint_from_env = endpoint_buffer.get();
}
#else
auto endpoint_from_env = std::getenv(otel_exporter_zipkin_endpoint_env);
#endif
return std::string{endpoint_from_env ? endpoint_from_env : kZipkinEndpointDefault};
}

Expand Down

0 comments on commit 7e114fc

Please sign in to comment.