Skip to content

Commit 3894904

Browse files
authored
Merge branch 'main' into fix-3302
2 parents df888c2 + 4af490f commit 3894904

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

exporters/elasticsearch/src/es_log_recordable.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,6 @@ void ElasticSearchRecordable::SetTimestamp(
8888
{
8989
const std::chrono::system_clock::time_point timePoint{timestamp};
9090

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

110104
const std::string dateStr(bufferDate);
111-
#endif
112105

113106
json_["@timestamp"] = dateStr;
114107
}

exporters/otlp/test/otlp_grpc_exporter_test.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
# include <grpcpp/grpcpp.h>
3939
# include <gtest/gtest.h>
40+
# include <future>
4041

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

513-
std::thread server_thread([&server, &service]() {
514+
std::promise<void> server_ready;
515+
auto server_ready_future = server_ready.get_future();
516+
517+
std::thread server_thread([&server, &service, &server_ready]() {
514518
std::string address("localhost:4317");
515519
grpc::ServerBuilder builder;
516520
builder.RegisterService(&service);
517521
builder.AddListeningPort(address, grpc::InsecureServerCredentials());
518522
server = builder.BuildAndStart();
523+
server_ready.set_value();
519524
server->Wait();
520525
});
521526

527+
server_ready_future.wait();
528+
522529
otlp::OtlpGrpcExporterOptions opts{};
523530

524531
if (is_retry_enabled)

0 commit comments

Comments
 (0)