Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 0 additions & 7 deletions exporters/elasticsearch/src/es_log_recordable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,6 @@ void ElasticSearchRecordable::SetTimestamp(
{
const std::chrono::system_clock::time_point timePoint{timestamp};

// If built with with at least cpp 20 then use std::format
// Otherwise use the old style to format the timestamp in UTC
// @see https://en.cppreference.com/w/cpp/feature_test#cpp_lib_format
#if defined(__cpp_lib_format) && __cpp_lib_format >= 201907
const std::string dateStr = std::format("{:%FT%T%Ez}", timePoint);
#else
std::time_t time = std::chrono::system_clock::to_time_t(timePoint);
std::tm tm = *std::gmtime(&time);
auto microseconds =
Expand All @@ -108,7 +102,6 @@ void ElasticSearchRecordable::SetTimestamp(
static_cast<long>(microseconds.count()));

const std::string dateStr(bufferDate);
#endif

json_["@timestamp"] = dateStr;
}
Expand Down
9 changes: 8 additions & 1 deletion exporters/otlp/test/otlp_grpc_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

# include <grpcpp/grpcpp.h>
# include <gtest/gtest.h>
# include <future>

# if defined(_MSC_VER)
# include "opentelemetry/sdk/common/env_variables.h"
Expand Down Expand Up @@ -510,15 +511,21 @@ TEST_P(OtlpGrpcExporterRetryIntegrationTests, StatusCodes)
TestTraceService service(status_codes);
std::unique_ptr<grpc::Server> server;

std::thread server_thread([&server, &service]() {
std::promise<void> server_ready;
auto server_ready_future = server_ready.get_future();

std::thread server_thread([&server, &service, &server_ready]() {
std::string address("localhost:4317");
grpc::ServerBuilder builder;
builder.RegisterService(&service);
builder.AddListeningPort(address, grpc::InsecureServerCredentials());
server = builder.BuildAndStart();
server_ready.set_value();
server->Wait();
});

server_ready_future.wait();

otlp::OtlpGrpcExporterOptions opts{};

if (is_retry_enabled)
Expand Down
Loading