From dbe9b50a69ac9530470f8e57e0570abe02098ec3 Mon Sep 17 00:00:00 2001 From: WenTao Ou Date: Fri, 2 Dec 2022 18:07:54 +0800 Subject: [PATCH] Restore `nostd::unique_ptr` to `std::unique_ptr` in sdk and exporters. Signed-off-by: WenTao Ou --- api/include/opentelemetry/nostd/shared_ptr.h | 8 +++++ examples/otlp/http_log_main.cc | 2 +- .../elasticsearch/es_log_record_exporter.h | 4 +-- .../src/es_log_record_exporter.cc | 8 ++--- .../exporters/ostream/log_record_exporter.h | 4 +-- exporters/ostream/src/log_record_exporter.cc | 8 ++--- exporters/ostream/test/ostream_log_test.cc | 12 +++---- .../otlp/otlp_grpc_log_record_exporter.h | 8 ++--- .../otlp_grpc_log_record_exporter_factory.h | 4 +-- .../otlp/otlp_http_log_record_exporter.h | 8 ++--- .../otlp_http_log_record_exporter_factory.h | 4 +-- .../exporters/otlp/otlp_recordable_utils.h | 2 +- .../otlp/src/otlp_grpc_log_record_exporter.cc | 8 ++--- .../otlp_grpc_log_record_exporter_factory.cc | 6 ++-- .../otlp/src/otlp_http_log_record_exporter.cc | 8 ++--- .../otlp_http_log_record_exporter_factory.cc | 6 ++-- exporters/otlp/src/otlp_recordable_utils.cc | 2 +- .../otlp_grpc_log_record_exporter_test.cc | 8 ++--- .../otlp_http_log_record_exporter_test.cc | 2 +- .../sdk/logs/batch_log_record_processor.h | 10 +++--- .../logs/batch_log_record_processor_factory.h | 6 ++-- sdk/include/opentelemetry/sdk/logs/exporter.h | 4 +-- sdk/include/opentelemetry/sdk/logs/logger.h | 9 ++--- .../opentelemetry/sdk/logs/logger_context.h | 8 +++-- .../sdk/logs/logger_context_factory.h | 10 +++--- .../opentelemetry/sdk/logs/logger_provider.h | 6 ++-- .../sdk/logs/logger_provider_factory.h | 18 +++++----- .../sdk/logs/multi_log_record_processor.h | 10 +++--- .../logs/multi_log_record_processor_factory.h | 4 +-- .../opentelemetry/sdk/logs/multi_recordable.h | 8 ++--- .../opentelemetry/sdk/logs/processor.h | 4 +-- .../sdk/logs/read_write_log_record.h | 3 +- .../sdk/logs/simple_log_record_processor.h | 9 ++--- .../simple_log_record_processor_factory.h | 5 +-- sdk/src/logs/batch_log_record_processor.cc | 14 ++++---- .../batch_log_record_processor_factory.cc | 6 ++-- sdk/src/logs/logger.cc | 4 +-- sdk/src/logs/logger_context.cc | 6 ++-- sdk/src/logs/logger_context_factory.cc | 10 +++--- sdk/src/logs/logger_provider.cc | 12 +++---- sdk/src/logs/logger_provider_factory.cc | 24 ++++++------- sdk/src/logs/multi_log_record_processor.cc | 10 +++--- .../multi_log_record_processor_factory.cc | 7 ++-- sdk/src/logs/multi_recordable.cc | 12 +++---- sdk/src/logs/read_write_log_record.cc | 6 ++-- sdk/src/logs/readable_log_record.cc | 2 +- sdk/src/logs/simple_log_record_processor.cc | 8 ++--- .../simple_log_record_processor_factory.cc | 7 ++-- .../logs/batch_log_record_processor_test.cc | 36 +++++++++---------- sdk/test/logs/logger_provider_sdk_test.cc | 14 ++++---- sdk/test/logs/logger_sdk_test.cc | 8 ++--- .../logs/simple_log_record_processor_test.cc | 28 +++++++-------- 52 files changed, 228 insertions(+), 212 deletions(-) diff --git a/api/include/opentelemetry/nostd/shared_ptr.h b/api/include/opentelemetry/nostd/shared_ptr.h index 44272e87ff..75b184f61c 100644 --- a/api/include/opentelemetry/nostd/shared_ptr.h +++ b/api/include/opentelemetry/nostd/shared_ptr.h @@ -103,6 +103,14 @@ class shared_ptr new (buffer_.data) shared_ptr_wrapper{std::move(ptr_)}; } +# ifndef HAVE_CPP_STDLIB + shared_ptr(std::unique_ptr &&other) noexcept + { + std::shared_ptr ptr_(other.release()); + new (buffer_.data) shared_ptr_wrapper{std::move(ptr_)}; + } +# endif + ~shared_ptr() { wrapper().~shared_ptr_wrapper(); } shared_ptr &operator=(shared_ptr &&other) noexcept diff --git a/examples/otlp/http_log_main.cc b/examples/otlp/http_log_main.cc index 19d8d80e76..ed52389f6e 100644 --- a/examples/otlp/http_log_main.cc +++ b/examples/otlp/http_log_main.cc @@ -49,7 +49,7 @@ void InitLogger() // Create OTLP exporter instance auto exporter = otlp::OtlpHttpLogRecordExporterFactory::Create(logger_opts); auto processor = logs_sdk::SimpleLogRecordProcessorFactory::Create(std::move(exporter)); - nostd::shared_ptr provider = + std::shared_ptr provider = logs_sdk::LoggerProviderFactory::Create(std::move(processor)); opentelemetry::logs::Provider::SetLoggerProvider(provider); diff --git a/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h b/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h index 7e09ae8d1b..7a52810df0 100644 --- a/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h +++ b/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h @@ -79,7 +79,7 @@ class ElasticsearchLogRecordExporter final : public opentelemetry::sdk::logs::Lo * Creates a recordable that stores the data in a JSON object * @return a newly initialized Recordable object. */ - nostd::unique_ptr MakeRecordable() noexcept override; + std::unique_ptr MakeRecordable() noexcept override; /** * Exports a vector of log records to the Elasticsearch instance. Guaranteed to return after a @@ -87,7 +87,7 @@ class ElasticsearchLogRecordExporter final : public opentelemetry::sdk::logs::Lo * @param records A list of log records to send to Elasticsearch. */ sdk::common::ExportResult Export( - const opentelemetry::nostd::span> + const opentelemetry::nostd::span> &records) noexcept override; /** diff --git a/exporters/elasticsearch/src/es_log_record_exporter.cc b/exporters/elasticsearch/src/es_log_record_exporter.cc index dc38e4bafd..fcf92b05f6 100644 --- a/exporters/elasticsearch/src/es_log_record_exporter.cc +++ b/exporters/elasticsearch/src/es_log_record_exporter.cc @@ -299,13 +299,13 @@ ElasticsearchLogRecordExporter::ElasticsearchLogRecordExporter( : options_{options}, http_client_{ext::http::client::HttpClientFactory::Create()} {} -nostd::unique_ptr ElasticsearchLogRecordExporter::MakeRecordable() noexcept +std::unique_ptr ElasticsearchLogRecordExporter::MakeRecordable() noexcept { - return nostd::unique_ptr(new ElasticSearchRecordable()); + return std::unique_ptr(new ElasticSearchRecordable()); } sdk::common::ExportResult ElasticsearchLogRecordExporter::Export( - const nostd::span> &records) noexcept + const nostd::span> &records) noexcept { // Return failure if this exporter has been shutdown if (isShutdown()) @@ -334,7 +334,7 @@ sdk::common::ExportResult ElasticsearchLogRecordExporter::Export( body += "{\"index\" : {}}\n"; // Add the context of the Recordable - auto json_record = nostd::unique_ptr( + auto json_record = std::unique_ptr( static_cast(record.release())); body += json_record->GetJSON().dump() + "\n"; } diff --git a/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h b/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h index 113b0bf21b..f5e400946f 100644 --- a/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h +++ b/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h @@ -30,13 +30,13 @@ class OStreamLogRecordExporter final : public opentelemetry::sdk::logs::LogRecor */ explicit OStreamLogRecordExporter(std::ostream &sout = std::cout) noexcept; - nostd::unique_ptr MakeRecordable() noexcept override; + std::unique_ptr MakeRecordable() noexcept override; /** * Exports a span of logs sent from the processor. */ opentelemetry::sdk::common::ExportResult Export( - const opentelemetry::nostd::span> &records) noexcept + const opentelemetry::nostd::span> &records) noexcept override; /** diff --git a/exporters/ostream/src/log_record_exporter.cc b/exporters/ostream/src/log_record_exporter.cc index 73b9bb1ac6..ca751b810e 100644 --- a/exporters/ostream/src/log_record_exporter.cc +++ b/exporters/ostream/src/log_record_exporter.cc @@ -26,13 +26,13 @@ OStreamLogRecordExporter::OStreamLogRecordExporter(std::ostream &sout) noexcept /*********************** Exporter methods ***********************/ -nostd::unique_ptr OStreamLogRecordExporter::MakeRecordable() noexcept +std::unique_ptr OStreamLogRecordExporter::MakeRecordable() noexcept { - return nostd::unique_ptr(new sdklogs::ReadWriteLogRecord()); + return std::unique_ptr(new sdklogs::ReadWriteLogRecord()); } sdk::common::ExportResult OStreamLogRecordExporter::Export( - const nostd::span> &records) noexcept + const nostd::span> &records) noexcept { if (isShutdown()) { @@ -43,7 +43,7 @@ sdk::common::ExportResult OStreamLogRecordExporter::Export( for (auto &record : records) { - auto log_record = nostd::unique_ptr( + auto log_record = std::unique_ptr( static_cast(record.release())); if (log_record == nullptr) diff --git a/exporters/ostream/test/ostream_log_test.cc b/exporters/ostream/test/ostream_log_test.cc index b3e057bebd..e247f06038 100644 --- a/exporters/ostream/test/ostream_log_test.cc +++ b/exporters/ostream/test/ostream_log_test.cc @@ -44,7 +44,7 @@ TEST(OStreamLogRecordExporter, Shutdown) // After processor/exporter is shutdown, no logs should be sent to stream auto record = exporter->MakeRecordable(); static_cast(record.get())->SetBody("Log record not empty"); - exporter->Export(nostd::span>(&record, 1)); + exporter->Export(nostd::span>(&record, 1)); // Restore original stringstream buffer std::cout.rdbuf(original); @@ -71,7 +71,7 @@ TEST(OstreamLogExporter, DefaultLogRecordToCout) // Pass a default recordable created by the exporter to be exported auto log_record = exporter->MakeRecordable(); - exporter->Export(nostd::span>(&log_record, 1)); + exporter->Export(nostd::span>(&log_record, 1)); // Restore cout's original stringstream std::cout.rdbuf(original); @@ -115,7 +115,7 @@ TEST(OStreamLogRecordExporter, SimpleLogToCout) // Create a log record and manually timestamp, severity, name, message common::SystemTimestamp now(std::chrono::system_clock::now()); - auto record = nostd::unique_ptr(new sdklogs::ReadWriteLogRecord()); + auto record = std::unique_ptr(new sdklogs::ReadWriteLogRecord()); static_cast(record.get())->SetTimestamp(now); static_cast(record.get())->SetObservedTimestamp(now); static_cast(record.get()) @@ -123,7 +123,7 @@ TEST(OStreamLogRecordExporter, SimpleLogToCout) static_cast(record.get())->SetBody("Message"); // Log a record to cout - exporter->Export(nostd::span>(&record, 1)); + exporter->Export(nostd::span>(&record, 1)); // Reset cout's original stringstream buffer std::cout.rdbuf(original); @@ -181,7 +181,7 @@ TEST(OStreamLogRecordExporter, LogWithStringAttributesToCerr) static_cast(record.get())->SetAttribute("a", true); // Log record to cerr - exporter->Export(nostd::span>(&record, 1)); + exporter->Export(nostd::span>(&record, 1)); // Reset cerr's original stringstream buffer std::cerr.rdbuf(original); @@ -244,7 +244,7 @@ TEST(OStreamLogRecordExporter, LogWithVariantTypesToClog) ->SetAttribute("attr1", nostd::span{array.data(), array.size()}); // Log a record to clog - exporter->Export(nostd::span>(&record, 1)); + exporter->Export(nostd::span>(&record, 1)); // Reset clog's original stringstream buffer std::clog.rdbuf(original); diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h index c3367da1cb..05224550a3 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h @@ -44,7 +44,7 @@ class OtlpGrpcLogRecordExporter : public opentelemetry::sdk::logs::LogRecordExpo * Creates a recordable that stores the data in protobuf. * @return a newly initialized Recordable object. */ - nostd::unique_ptr MakeRecordable() noexcept override; + std::unique_ptr MakeRecordable() noexcept override; /** * Exports a vector of log records to the configured gRPC endpoint. Guaranteed to return after a @@ -52,7 +52,7 @@ class OtlpGrpcLogRecordExporter : public opentelemetry::sdk::logs::LogRecordExpo * @param records A list of log records. */ opentelemetry::sdk::common::ExportResult Export( - const nostd::span> &records) noexcept + const nostd::span> &records) noexcept override; /** @@ -70,7 +70,7 @@ class OtlpGrpcLogRecordExporter : public opentelemetry::sdk::logs::LogRecordExpo friend class OtlpGrpcLogRecordExporterTestPeer; // Store service stub internally. Useful for testing. - nostd::unique_ptr log_service_stub_; + std::unique_ptr log_service_stub_; /** * Create an OtlpGrpcLogRecordExporter using the specified service stub. @@ -78,7 +78,7 @@ class OtlpGrpcLogRecordExporter : public opentelemetry::sdk::logs::LogRecordExpo * @param stub the service stub to be used for exporting */ OtlpGrpcLogRecordExporter( - nostd::unique_ptr stub); + std::unique_ptr stub); bool is_shutdown_ = false; mutable opentelemetry::common::SpinLockMutex lock_; bool isShutdown() const noexcept; diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h index 90390c8945..84e5aa1e96 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h @@ -23,12 +23,12 @@ class OtlpGrpcLogRecordExporterFactory /** * Create a OtlpGrpcLogRecordExporter. */ - static nostd::unique_ptr Create(); + static std::unique_ptr Create(); /** * Create a OtlpGrpcLogRecordExporter. */ - static nostd::unique_ptr Create( + static std::unique_ptr Create( const OtlpGrpcExporterOptions &options); }; diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h index af0e78c8ea..2250cfe831 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h @@ -42,7 +42,7 @@ class OtlpHttpLogRecordExporter final : public opentelemetry::sdk::logs::LogReco /** * Creates a recordable that stores the data in a JSON object */ - nostd::unique_ptr MakeRecordable() noexcept override; + std::unique_ptr MakeRecordable() noexcept override; /** * Exports a vector of log records to the Elasticsearch instance. Guaranteed to return after a @@ -50,7 +50,7 @@ class OtlpHttpLogRecordExporter final : public opentelemetry::sdk::logs::LogReco * @param records A list of log records to send to Elasticsearch. */ opentelemetry::sdk::common::ExportResult Export( - const nostd::span> &records) noexcept + const nostd::span> &records) noexcept override; /** @@ -65,7 +65,7 @@ class OtlpHttpLogRecordExporter final : public opentelemetry::sdk::logs::LogReco const OtlpHttpLogRecordExporterOptions options_; // Object that stores the HTTP sessions that have been created - nostd::unique_ptr http_client_; + std::unique_ptr http_client_; // For testing friend class OtlpHttpLogRecordExporterTestPeer; /** @@ -73,7 +73,7 @@ class OtlpHttpLogRecordExporter final : public opentelemetry::sdk::logs::LogReco * Only tests can call this constructor directly. * @param http_client the http client to be used for exporting */ - OtlpHttpLogRecordExporter(nostd::unique_ptr http_client); + OtlpHttpLogRecordExporter(std::unique_ptr http_client); }; } // namespace otlp } // namespace exporter diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h index c634ca076c..d2ea095245 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h @@ -24,12 +24,12 @@ class OtlpHttpLogRecordExporterFactory /** * Create a OtlpHttpLogRecordExporter. */ - static nostd::unique_ptr Create(); + static std::unique_ptr Create(); /** * Create a OtlpHttpLogRecordExporter. */ - static nostd::unique_ptr Create( + static std::unique_ptr Create( const OtlpHttpLogRecordExporterOptions &options); }; diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_recordable_utils.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_recordable_utils.h index 051145e0b2..1ad9514aa9 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_recordable_utils.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_recordable_utils.h @@ -37,7 +37,7 @@ class OtlpRecordableUtils #ifdef ENABLE_LOGS_PREVIEW static void PopulateRequest( - const nostd::span> &logs, + const nostd::span> &logs, proto::collector::logs::v1::ExportLogsServiceRequest *request) noexcept; #endif }; diff --git a/exporters/otlp/src/otlp_grpc_log_record_exporter.cc b/exporters/otlp/src/otlp_grpc_log_record_exporter.cc index db81037a39..e8a3b8a46a 100644 --- a/exporters/otlp/src/otlp_grpc_log_record_exporter.cc +++ b/exporters/otlp/src/otlp_grpc_log_record_exporter.cc @@ -42,20 +42,20 @@ OtlpGrpcLogRecordExporter::OtlpGrpcLogRecordExporter(const OtlpGrpcExporterOptio {} OtlpGrpcLogRecordExporter::OtlpGrpcLogRecordExporter( - nostd::unique_ptr stub) + std::unique_ptr stub) : options_(OtlpGrpcExporterOptions()), log_service_stub_(std::move(stub)) {} // ----------------------------- Exporter methods ------------------------------ -nostd::unique_ptr +std::unique_ptr OtlpGrpcLogRecordExporter::MakeRecordable() noexcept { - return nostd::unique_ptr(new OtlpLogRecordable()); + return std::unique_ptr(new OtlpLogRecordable()); } opentelemetry::sdk::common::ExportResult OtlpGrpcLogRecordExporter::Export( - const nostd::span> &logs) noexcept + const nostd::span> &logs) noexcept { if (isShutdown()) { diff --git a/exporters/otlp/src/otlp_grpc_log_record_exporter_factory.cc b/exporters/otlp/src/otlp_grpc_log_record_exporter_factory.cc index de44a870e1..d52a6269ba 100644 --- a/exporters/otlp/src/otlp_grpc_log_record_exporter_factory.cc +++ b/exporters/otlp/src/otlp_grpc_log_record_exporter_factory.cc @@ -15,17 +15,17 @@ namespace exporter namespace otlp { -nostd::unique_ptr +std::unique_ptr OtlpGrpcLogRecordExporterFactory::Create() { OtlpGrpcExporterOptions options; return Create(options); } -nostd::unique_ptr +std::unique_ptr OtlpGrpcLogRecordExporterFactory::Create(const OtlpGrpcExporterOptions &options) { - nostd::unique_ptr exporter( + std::unique_ptr exporter( new OtlpGrpcLogRecordExporter(options)); return exporter; } diff --git a/exporters/otlp/src/otlp_http_log_record_exporter.cc b/exporters/otlp/src/otlp_http_log_record_exporter.cc index 6d1603dd1e..3cb94e3537 100644 --- a/exporters/otlp/src/otlp_http_log_record_exporter.cc +++ b/exporters/otlp/src/otlp_http_log_record_exporter.cc @@ -45,7 +45,7 @@ OtlpHttpLogRecordExporter::OtlpHttpLogRecordExporter( ))) {} -OtlpHttpLogRecordExporter::OtlpHttpLogRecordExporter(nostd::unique_ptr http_client) +OtlpHttpLogRecordExporter::OtlpHttpLogRecordExporter(std::unique_ptr http_client) : options_(OtlpHttpLogRecordExporterOptions()), http_client_(std::move(http_client)) { OtlpHttpLogRecordExporterOptions &options = @@ -64,14 +64,14 @@ OtlpHttpLogRecordExporter::OtlpHttpLogRecordExporter(nostd::unique_ptr +std::unique_ptr OtlpHttpLogRecordExporter::MakeRecordable() noexcept { - return nostd::unique_ptr(new OtlpLogRecordable()); + return std::unique_ptr(new OtlpLogRecordable()); } opentelemetry::sdk::common::ExportResult OtlpHttpLogRecordExporter::Export( - const nostd::span> &logs) noexcept + const nostd::span> &logs) noexcept { if (http_client_->IsShutdown()) { diff --git a/exporters/otlp/src/otlp_http_log_record_exporter_factory.cc b/exporters/otlp/src/otlp_http_log_record_exporter_factory.cc index 0cb1184200..d05d68ce26 100644 --- a/exporters/otlp/src/otlp_http_log_record_exporter_factory.cc +++ b/exporters/otlp/src/otlp_http_log_record_exporter_factory.cc @@ -13,17 +13,17 @@ namespace exporter namespace otlp { -nostd::unique_ptr +std::unique_ptr OtlpHttpLogRecordExporterFactory::Create() { OtlpHttpLogRecordExporterOptions options; return Create(options); } -nostd::unique_ptr +std::unique_ptr OtlpHttpLogRecordExporterFactory::Create(const OtlpHttpLogRecordExporterOptions &options) { - nostd::unique_ptr exporter( + std::unique_ptr exporter( new OtlpHttpLogRecordExporter(options)); return exporter; } diff --git a/exporters/otlp/src/otlp_recordable_utils.cc b/exporters/otlp/src/otlp_recordable_utils.cc index 2e2996883d..a7f688d7f3 100644 --- a/exporters/otlp/src/otlp_recordable_utils.cc +++ b/exporters/otlp/src/otlp_recordable_utils.cc @@ -74,7 +74,7 @@ void OtlpRecordableUtils::PopulateRequest( #ifdef ENABLE_LOGS_PREVIEW void OtlpRecordableUtils::PopulateRequest( - const nostd::span> &logs, + const nostd::span> &logs, proto::collector::logs::v1::ExportLogsServiceRequest *request) noexcept { if (nullptr == request) diff --git a/exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc b/exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc index 6bf92daf87..f87b5bf2d7 100644 --- a/exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc +++ b/exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc @@ -62,7 +62,7 @@ TEST_F(OtlpGrpcLogRecordExporterTestPeer, ShutdownTest) auto recordable_2 = exporter->MakeRecordable(); // exporter shuold not be shutdown by default - nostd::span> batch_1(&recordable_1, 1); + nostd::span> batch_1(&recordable_1, 1); EXPECT_CALL(*mock_stub, Export(_, _, _)) .Times(Exactly(1)) .WillOnce(Return(grpc::Status::OK)) @@ -73,7 +73,7 @@ TEST_F(OtlpGrpcLogRecordExporterTestPeer, ShutdownTest) exporter->Shutdown(); - nostd::span> batch_2(&recordable_2, 1); + nostd::span> batch_2(&recordable_2, 1); result = exporter->Export(batch_2); EXPECT_EQ(sdk::common::ExportResult::kFailure, result); } @@ -89,13 +89,13 @@ TEST_F(OtlpGrpcLogRecordExporterTestPeer, ExportUnitTest) auto recordable_2 = exporter->MakeRecordable(); // Test successful RPC - nostd::span> batch_1(&recordable_1, 1); + nostd::span> batch_1(&recordable_1, 1); EXPECT_CALL(*mock_stub, Export(_, _, _)).Times(Exactly(1)).WillOnce(Return(grpc::Status::OK)); auto result = exporter->Export(batch_1); EXPECT_EQ(sdk::common::ExportResult::kSuccess, result); // Test failed RPC - nostd::span> batch_2(&recordable_2, 1); + nostd::span> batch_2(&recordable_2, 1); EXPECT_CALL(*mock_stub, Export(_, _, _)) .Times(Exactly(1)) .WillOnce(Return(grpc::Status::CANCELLED)); diff --git a/exporters/otlp/test/otlp_http_log_record_exporter_test.cc b/exporters/otlp/test/otlp_http_log_record_exporter_test.cc index 240de8b40d..08bc4b1fca 100644 --- a/exporters/otlp/test/otlp_http_log_record_exporter_test.cc +++ b/exporters/otlp/test/otlp_http_log_record_exporter_test.cc @@ -491,7 +491,7 @@ TEST(OtlpHttpLogRecordExporterTest, Shutdown) std::unique_ptr(new OtlpHttpLogRecordExporter()); ASSERT_TRUE(exporter->Shutdown()); - nostd::span> logs = {}; + nostd::span> logs = {}; auto result = exporter->Export(logs); EXPECT_EQ(result, opentelemetry::sdk::common::ExportResult::kFailure); diff --git a/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h index f9b30d9195..0621316dcd 100644 --- a/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h +++ b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h @@ -41,7 +41,7 @@ class BatchLogRecordProcessor : public LogRecordProcessor * equal to max_queue_size */ explicit BatchLogRecordProcessor( - nostd::unique_ptr &&exporter, + std::unique_ptr &&exporter, const size_t max_queue_size = 2048, const std::chrono::milliseconds scheduled_delay_millis = std::chrono::milliseconds(5000), const size_t max_export_batch_size = 512); @@ -53,18 +53,18 @@ class BatchLogRecordProcessor : public LogRecordProcessor * @param exporter - The backend exporter to pass the logs to * @param options - The batch SpanProcessor options. */ - explicit BatchLogRecordProcessor(nostd::unique_ptr &&exporter, + explicit BatchLogRecordProcessor(std::unique_ptr &&exporter, const BatchLogRecordProcessorOptions &options); /** Makes a new recordable **/ - nostd::unique_ptr MakeRecordable() noexcept override; + std::unique_ptr MakeRecordable() noexcept override; /** * Called when the Logger's log method creates a log record * @param record the log record */ - void OnEmit(nostd::unique_ptr &&record) noexcept override; + void OnEmit(std::unique_ptr &&record) noexcept override; /** * Export all log records that have not been exported yet. @@ -134,7 +134,7 @@ class BatchLogRecordProcessor : public LogRecordProcessor std::chrono::time_point &start_time); /* The configured backend log exporter */ - nostd::unique_ptr exporter_; + std::unique_ptr exporter_; /* Configurable parameters as per the official *trace* specs */ const size_t max_queue_size_; diff --git a/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_factory.h b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_factory.h index e670a66d69..3177eb31e1 100644 --- a/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_factory.h @@ -5,6 +5,8 @@ #ifdef ENABLE_LOGS_PREVIEW +# include + # include "opentelemetry/sdk/logs/batch_log_record_processor_options.h" # include "opentelemetry/sdk/logs/exporter.h" # include "opentelemetry/sdk/logs/processor.h" @@ -25,8 +27,8 @@ class BatchLogRecordProcessorFactory /** * Create a BatchLogRecordProcessor. */ - nostd::unique_ptr Create(nostd::unique_ptr &&exporter, - const BatchLogRecordProcessorOptions &options); + std::unique_ptr Create(std::unique_ptr &&exporter, + const BatchLogRecordProcessorOptions &options); }; } // namespace logs diff --git a/sdk/include/opentelemetry/sdk/logs/exporter.h b/sdk/include/opentelemetry/sdk/logs/exporter.h index 76ec8cb320..047451df65 100644 --- a/sdk/include/opentelemetry/sdk/logs/exporter.h +++ b/sdk/include/opentelemetry/sdk/logs/exporter.h @@ -34,7 +34,7 @@ class LogRecordExporter * * Note: This method must be callable from multiple threads. */ - virtual nostd::unique_ptr MakeRecordable() noexcept = 0; + virtual std::unique_ptr MakeRecordable() noexcept = 0; /** * Exports the batch of log records to their export destination. @@ -45,7 +45,7 @@ class LogRecordExporter * @returns an ExportResult code (whether export was success or failure) */ virtual sdk::common::ExportResult Export( - const nostd::span> &records) noexcept = 0; + const nostd::span> &records) noexcept = 0; /** * Marks the exporter as ShutDown and cleans up any resources as required. diff --git a/sdk/include/opentelemetry/sdk/logs/logger.h b/sdk/include/opentelemetry/sdk/logs/logger.h index e8f8cfadab..d290df98c3 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger.h +++ b/sdk/include/opentelemetry/sdk/logs/logger.h @@ -4,6 +4,9 @@ #pragma once #ifdef ENABLE_LOGS_PREVIEW +# include +# include + # include "opentelemetry/common/macros.h" # include "opentelemetry/logs/logger.h" # include "opentelemetry/nostd/unique_ptr.h" @@ -11,8 +14,6 @@ # include "opentelemetry/sdk/logs/logger_context.h" # include "opentelemetry/sdk/logs/logger_provider.h" -# include - OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk { @@ -31,7 +32,7 @@ class Logger final : public opentelemetry::logs::Logger explicit Logger( opentelemetry::nostd::string_view name, std::shared_ptr context, - nostd::unique_ptr instrumentation_scope = + std::unique_ptr instrumentation_scope = instrumentationscope::InstrumentationScope::Create("")) noexcept; /** @@ -63,7 +64,7 @@ class Logger final : public opentelemetry::logs::Logger // order of declaration is important here - instrumentation scope should destroy after // logger-context. - nostd::unique_ptr instrumentation_scope_; + std::unique_ptr instrumentation_scope_; std::shared_ptr context_; }; diff --git a/sdk/include/opentelemetry/sdk/logs/logger_context.h b/sdk/include/opentelemetry/sdk/logs/logger_context.h index b416f67eaf..fe6db6822a 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger_context.h +++ b/sdk/include/opentelemetry/sdk/logs/logger_context.h @@ -5,6 +5,8 @@ #ifdef ENABLE_LOGS_PREVIEW +# include + # include "opentelemetry/sdk/logs/processor.h" # include "opentelemetry/sdk/resource/resource.h" # include "opentelemetry/version.h" @@ -30,7 +32,7 @@ namespace logs class LoggerContext { public: - explicit LoggerContext(std::vector> &&processors, + explicit LoggerContext(std::vector> &&processors, opentelemetry::sdk::resource::Resource resource = opentelemetry::sdk::resource::Resource::Create({})) noexcept; @@ -42,7 +44,7 @@ class LoggerContext * * Note: This method is not thread safe. */ - void AddProcessor(nostd::unique_ptr processor) noexcept; + void AddProcessor(std::unique_ptr processor) noexcept; /** * Obtain the configured (composite) processor. @@ -72,7 +74,7 @@ class LoggerContext private: // order of declaration is important here - resource object should be destroyed after processor. opentelemetry::sdk::resource::Resource resource_; - nostd::unique_ptr processor_; + std::unique_ptr processor_; }; } // namespace logs } // namespace sdk diff --git a/sdk/include/opentelemetry/sdk/logs/logger_context_factory.h b/sdk/include/opentelemetry/sdk/logs/logger_context_factory.h index 86ae4f8f00..377094d5db 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger_context_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/logger_context_factory.h @@ -5,6 +5,8 @@ #ifdef ENABLE_LOGS_PREVIEW +# include + # include "opentelemetry/sdk/logs/logger_context.h" # include "opentelemetry/sdk/logs/processor.h" # include "opentelemetry/sdk/resource/resource.h" @@ -25,14 +27,14 @@ class LoggerContextFactory /** * Create a LoggerContext. */ - static nostd::unique_ptr Create( - std::vector> &&processors); + static std::unique_ptr Create( + std::vector> &&processors); /** * Create a LoggerContext. */ - static nostd::unique_ptr Create( - std::vector> &&processors, + static std::unique_ptr Create( + std::vector> &&processors, const opentelemetry::sdk::resource::Resource &resource); }; diff --git a/sdk/include/opentelemetry/sdk/logs/logger_provider.h b/sdk/include/opentelemetry/sdk/logs/logger_provider.h index ee99c5a393..fd38532752 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger_provider.h +++ b/sdk/include/opentelemetry/sdk/logs/logger_provider.h @@ -41,11 +41,11 @@ class LoggerProvider final : public opentelemetry::logs::LoggerProvider * @param id_generator The custom id generator for this logger provider. This must * not be a nullptr */ - explicit LoggerProvider(nostd::unique_ptr &&processor, + explicit LoggerProvider(std::unique_ptr &&processor, opentelemetry::sdk::resource::Resource resource = opentelemetry::sdk::resource::Resource::Create({})) noexcept; - explicit LoggerProvider(std::vector> &&processors, + explicit LoggerProvider(std::vector> &&processors, opentelemetry::sdk::resource::Resource resource = opentelemetry::sdk::resource::Resource::Create({})) noexcept; @@ -101,7 +101,7 @@ class LoggerProvider final : public opentelemetry::logs::LoggerProvider * @param processor The processor to be stored inside the logger provider. * This must not be a nullptr. */ - void AddProcessor(nostd::unique_ptr processor) noexcept; + void AddProcessor(std::unique_ptr processor) noexcept; /** * Obtain the resource associated with this logger provider. diff --git a/sdk/include/opentelemetry/sdk/logs/logger_provider_factory.h b/sdk/include/opentelemetry/sdk/logs/logger_provider_factory.h index e68efd33aa..e103fce8be 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger_provider_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/logger_provider_factory.h @@ -30,33 +30,33 @@ class LoggerProviderFactory /** * Create a LoggerProvider. */ - static nostd::unique_ptr Create( - nostd::unique_ptr &&processor); + static std::unique_ptr Create( + std::unique_ptr &&processor); /** * Create a LoggerProvider. */ - static nostd::unique_ptr Create( - nostd::unique_ptr &&processor, + static std::unique_ptr Create( + std::unique_ptr &&processor, const opentelemetry::sdk::resource::Resource &resource); /** * Create a LoggerProvider. */ - static nostd::unique_ptr Create( - std::vector> &&processors); + static std::unique_ptr Create( + std::vector> &&processors); /** * Create a LoggerProvider. */ - static nostd::unique_ptr Create( - std::vector> &&processors, + static std::unique_ptr Create( + std::vector> &&processors, const opentelemetry::sdk::resource::Resource &resource); /** * Create a LoggerProvider. */ - static nostd::unique_ptr Create( + static std::unique_ptr Create( std::shared_ptr context); }; diff --git a/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h b/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h index e4a6d59ec7..54a7e7959e 100644 --- a/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h +++ b/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h @@ -28,18 +28,18 @@ namespace logs class MultiLogRecordProcessor : public LogRecordProcessor { public: - MultiLogRecordProcessor(std::vector> &&processors); + MultiLogRecordProcessor(std::vector> &&processors); ~MultiLogRecordProcessor() override; - void AddProcessor(nostd::unique_ptr &&processor); + void AddProcessor(std::unique_ptr &&processor); - nostd::unique_ptr MakeRecordable() noexcept override; + std::unique_ptr MakeRecordable() noexcept override; /** * OnEmit is called by the SDK once a log record has been successfully created. * @param record the log record */ - void OnEmit(nostd::unique_ptr &&record) noexcept override; + void OnEmit(std::unique_ptr &&record) noexcept override; /** * Exports all log records that have not yet been exported to the configured Exporter. @@ -60,7 +60,7 @@ class MultiLogRecordProcessor : public LogRecordProcessor std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override; private: - std::vector> processors_; + std::vector> processors_; }; } // namespace logs } // namespace sdk diff --git a/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor_factory.h b/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor_factory.h index f6879d2fcc..0e8b9a5878 100644 --- a/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor_factory.h @@ -22,8 +22,8 @@ namespace logs class MultiLogRecordProcessorFactory { public: - static nostd::unique_ptr Create( - std::vector> &&processors); + static std::unique_ptr Create( + std::vector> &&processors); }; } // namespace logs diff --git a/sdk/include/opentelemetry/sdk/logs/multi_recordable.h b/sdk/include/opentelemetry/sdk/logs/multi_recordable.h index b369cdaa03..8bbc2ae200 100644 --- a/sdk/include/opentelemetry/sdk/logs/multi_recordable.h +++ b/sdk/include/opentelemetry/sdk/logs/multi_recordable.h @@ -24,12 +24,12 @@ class MultiRecordable final : public Recordable { public: void AddRecordable(const LogRecordProcessor &processor, - nostd::unique_ptr recordable) noexcept; + std::unique_ptr recordable) noexcept; - const nostd::unique_ptr &GetRecordable( + const std::unique_ptr &GetRecordable( const LogRecordProcessor &processor) const noexcept; - nostd::unique_ptr ReleaseRecordable(const LogRecordProcessor &processor) noexcept; + std::unique_ptr ReleaseRecordable(const LogRecordProcessor &processor) noexcept; /** * Set the timestamp for this log. @@ -95,7 +95,7 @@ class MultiRecordable final : public Recordable &instrumentation_scope) noexcept override; private: - std::unordered_map> recordables_; + std::unordered_map> recordables_; }; } // namespace logs } // namespace sdk diff --git a/sdk/include/opentelemetry/sdk/logs/processor.h b/sdk/include/opentelemetry/sdk/logs/processor.h index bef5fd4882..74976ddb7d 100644 --- a/sdk/include/opentelemetry/sdk/logs/processor.h +++ b/sdk/include/opentelemetry/sdk/logs/processor.h @@ -32,13 +32,13 @@ class LogRecordProcessor * * Note: This method must be callable from multiple threads. */ - virtual nostd::unique_ptr MakeRecordable() noexcept = 0; + virtual std::unique_ptr MakeRecordable() noexcept = 0; /** * OnEmit is called by the SDK once a log record has been successfully created. * @param record the log recordable object */ - virtual void OnEmit(nostd::unique_ptr &&record) noexcept = 0; + virtual void OnEmit(std::unique_ptr &&record) noexcept = 0; /** * Exports all log records that have not yet been exported to the configured Exporter. diff --git a/sdk/include/opentelemetry/sdk/logs/read_write_log_record.h b/sdk/include/opentelemetry/sdk/logs/read_write_log_record.h index a043f7b5fd..c81a2da126 100644 --- a/sdk/include/opentelemetry/sdk/logs/read_write_log_record.h +++ b/sdk/include/opentelemetry/sdk/logs/read_write_log_record.h @@ -4,6 +4,7 @@ #pragma once #ifdef ENABLE_LOGS_PREVIEW +# include # include # include "opentelemetry/common/attribute_value.h" @@ -182,7 +183,7 @@ class ReadWriteLogRecord final : public ReadableLogRecord opentelemetry::trace::SpanId span_id; opentelemetry::trace::TraceFlags trace_flags; }; - nostd::unique_ptr trace_state_; + std::unique_ptr trace_state_; }; } // namespace logs } // namespace sdk diff --git a/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h b/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h index 5c8d790696..f3d6bc27c3 100644 --- a/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h +++ b/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h @@ -5,6 +5,7 @@ #ifdef ENABLE_LOGS_PREVIEW # include +# include # include # include "opentelemetry/common/spin_lock_mutex.h" @@ -28,12 +29,12 @@ class SimpleLogRecordProcessor : public LogRecordProcessor { public: - explicit SimpleLogRecordProcessor(nostd::unique_ptr &&exporter); + explicit SimpleLogRecordProcessor(std::unique_ptr &&exporter); ~SimpleLogRecordProcessor() override = default; - nostd::unique_ptr MakeRecordable() noexcept override; + std::unique_ptr MakeRecordable() noexcept override; - void OnEmit(nostd::unique_ptr &&record) noexcept override; + void OnEmit(std::unique_ptr &&record) noexcept override; bool ForceFlush( std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override; @@ -45,7 +46,7 @@ class SimpleLogRecordProcessor : public LogRecordProcessor private: // The configured exporter - nostd::unique_ptr exporter_; + std::unique_ptr exporter_; // The lock used to ensure the exporter is not called concurrently opentelemetry::common::SpinLockMutex lock_; // The atomic boolean to ensure the ShutDown() function is only called once diff --git a/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor_factory.h b/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor_factory.h index ce299263c9..a71ba05684 100644 --- a/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor_factory.h @@ -5,6 +5,8 @@ #ifdef ENABLE_LOGS_PREVIEW +# include + # include "opentelemetry/sdk/logs/exporter.h" # include "opentelemetry/sdk/logs/processor.h" @@ -23,8 +25,7 @@ class SimpleLogRecordProcessorFactory /** * Create a SimpleLogRecordProcessor. */ - static nostd::unique_ptr Create( - nostd::unique_ptr &&exporter); + static std::unique_ptr Create(std::unique_ptr &&exporter); }; } // namespace logs diff --git a/sdk/src/logs/batch_log_record_processor.cc b/sdk/src/logs/batch_log_record_processor.cc index 40bce9474e..7903c3b24c 100644 --- a/sdk/src/logs/batch_log_record_processor.cc +++ b/sdk/src/logs/batch_log_record_processor.cc @@ -15,7 +15,7 @@ namespace sdk namespace logs { BatchLogRecordProcessor::BatchLogRecordProcessor( - nostd::unique_ptr &&exporter, + std::unique_ptr &&exporter, const size_t max_queue_size, const std::chrono::milliseconds scheduled_delay_millis, const size_t max_export_batch_size) @@ -33,7 +33,7 @@ BatchLogRecordProcessor::BatchLogRecordProcessor( synchronization_data_->is_shutdown.store(false); } -BatchLogRecordProcessor::BatchLogRecordProcessor(nostd::unique_ptr &&exporter, +BatchLogRecordProcessor::BatchLogRecordProcessor(std::unique_ptr &&exporter, const BatchLogRecordProcessorOptions &options) : exporter_(std::move(exporter)), max_queue_size_(options.max_queue_size), @@ -49,12 +49,12 @@ BatchLogRecordProcessor::BatchLogRecordProcessor(nostd::unique_ptris_shutdown.store(false); } -nostd::unique_ptr BatchLogRecordProcessor::MakeRecordable() noexcept +std::unique_ptr BatchLogRecordProcessor::MakeRecordable() noexcept { return exporter_->MakeRecordable(); } -void BatchLogRecordProcessor::OnEmit(nostd::unique_ptr &&record) noexcept +void BatchLogRecordProcessor::OnEmit(std::unique_ptr &&record) noexcept { if (synchronization_data_->is_shutdown.load() == true) { @@ -186,7 +186,7 @@ void BatchLogRecordProcessor::Export() { do { - std::vector> records_arr; + std::vector> records_arr; size_t num_records_to_export; bool notify_force_flush = synchronization_data_->is_force_flush_pending.exchange(false, std::memory_order_acq_rel); @@ -211,13 +211,13 @@ void BatchLogRecordProcessor::Export() range.ForEach([&](AtomicUniquePtr &ptr) { std::unique_ptr swap_ptr = std::unique_ptr(nullptr); ptr.Swap(swap_ptr); - records_arr.push_back(nostd::unique_ptr(swap_ptr.release())); + records_arr.push_back(std::unique_ptr(swap_ptr.release())); return true; }); }); exporter_->Export( - nostd::span>(records_arr.data(), records_arr.size())); + nostd::span>(records_arr.data(), records_arr.size())); NotifyCompletion(notify_force_flush, synchronization_data_); } while (true); } diff --git a/sdk/src/logs/batch_log_record_processor_factory.cc b/sdk/src/logs/batch_log_record_processor_factory.cc index 65d78afd6e..67d0a677ab 100644 --- a/sdk/src/logs/batch_log_record_processor_factory.cc +++ b/sdk/src/logs/batch_log_record_processor_factory.cc @@ -12,11 +12,11 @@ namespace sdk namespace logs { -nostd::unique_ptr BatchLogRecordProcessorFactory::Create( - nostd::unique_ptr &&exporter, +std::unique_ptr BatchLogRecordProcessorFactory::Create( + std::unique_ptr &&exporter, const BatchLogRecordProcessorOptions &options) { - nostd::unique_ptr processor( + std::unique_ptr processor( new BatchLogRecordProcessor(std::move(exporter), options)); return processor; } diff --git a/sdk/src/logs/logger.cc b/sdk/src/logs/logger.cc index 5e3e7594f3..6232fa632b 100644 --- a/sdk/src/logs/logger.cc +++ b/sdk/src/logs/logger.cc @@ -19,7 +19,7 @@ namespace common = opentelemetry::common; Logger::Logger( nostd::string_view name, std::shared_ptr context, - nostd::unique_ptr instrumentation_scope) noexcept + std::unique_ptr instrumentation_scope) noexcept : logger_name_(std::string(name)), instrumentation_scope_(std::move(instrumentation_scope)), context_(context) @@ -54,7 +54,7 @@ void Logger::EmitLogRecord(nostd::unique_ptr &&l // TODO: Sampler (should include check for minSeverity) // Send the log recordable to the processor - processor.OnEmit(nostd::unique_ptr(static_cast(log_record.release()))); + processor.OnEmit(std::unique_ptr(static_cast(log_record.release()))); } const opentelemetry::sdk::instrumentationscope::InstrumentationScope & diff --git a/sdk/src/logs/logger_context.cc b/sdk/src/logs/logger_context.cc index deadbb77fa..3421ad9999 100644 --- a/sdk/src/logs/logger_context.cc +++ b/sdk/src/logs/logger_context.cc @@ -15,14 +15,14 @@ namespace sdk namespace logs { -LoggerContext::LoggerContext(std::vector> &&processors, +LoggerContext::LoggerContext(std::vector> &&processors, opentelemetry::sdk::resource::Resource resource) noexcept : resource_(resource), processor_( - nostd::unique_ptr(new MultiLogRecordProcessor(std::move(processors)))) + std::unique_ptr(new MultiLogRecordProcessor(std::move(processors)))) {} -void LoggerContext::AddProcessor(nostd::unique_ptr processor) noexcept +void LoggerContext::AddProcessor(std::unique_ptr processor) noexcept { auto multi_processor = static_cast(processor_.get()); multi_processor->AddProcessor(std::move(processor)); diff --git a/sdk/src/logs/logger_context_factory.cc b/sdk/src/logs/logger_context_factory.cc index 67e52ab670..985743fd67 100644 --- a/sdk/src/logs/logger_context_factory.cc +++ b/sdk/src/logs/logger_context_factory.cc @@ -14,18 +14,18 @@ namespace sdk namespace logs { -nostd::unique_ptr LoggerContextFactory::Create( - std::vector> &&processors) +std::unique_ptr LoggerContextFactory::Create( + std::vector> &&processors) { auto resource = opentelemetry::sdk::resource::Resource::Create({}); return Create(std::move(processors), resource); } -nostd::unique_ptr LoggerContextFactory::Create( - std::vector> &&processors, +std::unique_ptr LoggerContextFactory::Create( + std::vector> &&processors, const opentelemetry::sdk::resource::Resource &resource) { - nostd::unique_ptr context(new LoggerContext(std::move(processors), resource)); + std::unique_ptr context(new LoggerContext(std::move(processors), resource)); return context; } diff --git a/sdk/src/logs/logger_provider.cc b/sdk/src/logs/logger_provider.cc index 2abc0f1cbf..3000aa8230 100644 --- a/sdk/src/logs/logger_provider.cc +++ b/sdk/src/logs/logger_provider.cc @@ -21,16 +21,16 @@ namespace logs namespace nostd = opentelemetry::nostd; namespace logs_api = opentelemetry::logs; -LoggerProvider::LoggerProvider(nostd::unique_ptr &&processor, +LoggerProvider::LoggerProvider(std::unique_ptr &&processor, opentelemetry::sdk::resource::Resource resource) noexcept { - std::vector> processors; + std::vector> processors; processors.emplace_back(std::move(processor)); context_ = std::make_shared(std::move(processors), std::move(resource)); OTEL_INTERNAL_LOG_DEBUG("[LoggerProvider] LoggerProvider created."); } -LoggerProvider::LoggerProvider(std::vector> &&processors, +LoggerProvider::LoggerProvider(std::vector> &&processors, opentelemetry::sdk::resource::Resource resource) noexcept : context_{ std::make_shared(std::move(processors), std::move(resource))} @@ -38,7 +38,7 @@ LoggerProvider::LoggerProvider(std::vector LoggerProvider::LoggerProvider() noexcept : context_{std::make_shared( - std::vector>{})} + std::vector>{})} {} LoggerProvider::LoggerProvider(std::shared_ptr context) noexcept @@ -91,7 +91,7 @@ nostd::shared_ptr LoggerProvider::GetLogger( */ // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#field-instrumentationscope - opentelemetry::nostd::unique_ptr lib; + std::unique_ptr lib; if (library_name.empty()) { lib = instrumentationscope::InstrumentationScope::Create(logger_name, library_version, @@ -118,7 +118,7 @@ nostd::shared_ptr LoggerProvider::GetLogger( return GetLogger(logger_name, "", library_name, library_version, schema_url); } -void LoggerProvider::AddProcessor(nostd::unique_ptr processor) noexcept +void LoggerProvider::AddProcessor(std::unique_ptr processor) noexcept { context_->AddProcessor(std::move(processor)); } diff --git a/sdk/src/logs/logger_provider_factory.cc b/sdk/src/logs/logger_provider_factory.cc index 654b3f2d61..3177b9180e 100644 --- a/sdk/src/logs/logger_provider_factory.cc +++ b/sdk/src/logs/logger_provider_factory.cc @@ -13,42 +13,42 @@ namespace sdk namespace logs { -nostd::unique_ptr LoggerProviderFactory::Create( - nostd::unique_ptr &&processor) +std::unique_ptr LoggerProviderFactory::Create( + std::unique_ptr &&processor) { auto resource = opentelemetry::sdk::resource::Resource::Create({}); return Create(std::move(processor), resource); } -nostd::unique_ptr LoggerProviderFactory::Create( - nostd::unique_ptr &&processor, +std::unique_ptr LoggerProviderFactory::Create( + std::unique_ptr &&processor, const opentelemetry::sdk::resource::Resource &resource) { - nostd::unique_ptr provider( + std::unique_ptr provider( new LoggerProvider(std::move(processor), resource)); return provider; } -nostd::unique_ptr LoggerProviderFactory::Create( - std::vector> &&processors) +std::unique_ptr LoggerProviderFactory::Create( + std::vector> &&processors) { auto resource = opentelemetry::sdk::resource::Resource::Create({}); return Create(std::move(processors), resource); } -nostd::unique_ptr LoggerProviderFactory::Create( - std::vector> &&processors, +std::unique_ptr LoggerProviderFactory::Create( + std::vector> &&processors, const opentelemetry::sdk::resource::Resource &resource) { - nostd::unique_ptr provider( + std::unique_ptr provider( new LoggerProvider(std::move(processors), resource)); return provider; } -nostd::unique_ptr LoggerProviderFactory::Create( +std::unique_ptr LoggerProviderFactory::Create( std::shared_ptr context) { - nostd::unique_ptr provider(new LoggerProvider(context)); + std::unique_ptr provider(new LoggerProvider(context)); return provider; } diff --git a/sdk/src/logs/multi_log_record_processor.cc b/sdk/src/logs/multi_log_record_processor.cc index 1f47910b7e..2859126f80 100644 --- a/sdk/src/logs/multi_log_record_processor.cc +++ b/sdk/src/logs/multi_log_record_processor.cc @@ -16,7 +16,7 @@ namespace logs { MultiLogRecordProcessor::MultiLogRecordProcessor( - std::vector> &&processors) + std::vector> &&processors) { for (auto &processor : processors) { @@ -29,7 +29,7 @@ MultiLogRecordProcessor::~MultiLogRecordProcessor() Shutdown(); } -void MultiLogRecordProcessor::AddProcessor(nostd::unique_ptr &&processor) +void MultiLogRecordProcessor::AddProcessor(std::unique_ptr &&processor) { // Add preocessor to end of the list. if (processor) @@ -38,9 +38,9 @@ void MultiLogRecordProcessor::AddProcessor(nostd::unique_ptr } } -nostd::unique_ptr MultiLogRecordProcessor::MakeRecordable() noexcept +std::unique_ptr MultiLogRecordProcessor::MakeRecordable() noexcept { - auto recordable = nostd::unique_ptr(new MultiRecordable()); + auto recordable = std::unique_ptr(new MultiRecordable()); auto multi_recordable = static_cast(recordable.get()); for (auto &processor : processors_) { @@ -49,7 +49,7 @@ nostd::unique_ptr MultiLogRecordProcessor::MakeRecordable() noexcept return recordable; } -void MultiLogRecordProcessor::OnEmit(nostd::unique_ptr &&record) noexcept +void MultiLogRecordProcessor::OnEmit(std::unique_ptr &&record) noexcept { if (!record) { diff --git a/sdk/src/logs/multi_log_record_processor_factory.cc b/sdk/src/logs/multi_log_record_processor_factory.cc index 5f3aa4b2ab..3e0de46c32 100644 --- a/sdk/src/logs/multi_log_record_processor_factory.cc +++ b/sdk/src/logs/multi_log_record_processor_factory.cc @@ -16,11 +16,10 @@ namespace sdk namespace logs { -nostd::unique_ptr MultiLogRecordProcessorFactory::Create( - std::vector> &&processors) +std::unique_ptr MultiLogRecordProcessorFactory::Create( + std::vector> &&processors) { - nostd::unique_ptr processor( - new MultiLogRecordProcessor(std::move(processors))); + std::unique_ptr processor(new MultiLogRecordProcessor(std::move(processors))); return processor; } diff --git a/sdk/src/logs/multi_recordable.cc b/sdk/src/logs/multi_recordable.cc index f98935abdd..17e2c29777 100644 --- a/sdk/src/logs/multi_recordable.cc +++ b/sdk/src/logs/multi_recordable.cc @@ -25,12 +25,12 @@ std::size_t MakeKey(const opentelemetry::sdk::logs::LogRecordProcessor &processo } // namespace void MultiRecordable::AddRecordable(const LogRecordProcessor &processor, - nostd::unique_ptr recordable) noexcept + std::unique_ptr recordable) noexcept { recordables_[MakeKey(processor)] = std::move(recordable); } -const nostd::unique_ptr &MultiRecordable::GetRecordable( +const std::unique_ptr &MultiRecordable::GetRecordable( const LogRecordProcessor &processor) const noexcept { // TODO - return nullptr ref on failed lookup? @@ -39,21 +39,21 @@ const nostd::unique_ptr &MultiRecordable::GetRecordable( { return i->second; } - static nostd::unique_ptr empty(nullptr); + static std::unique_ptr empty(nullptr); return empty; } -nostd::unique_ptr MultiRecordable::ReleaseRecordable( +std::unique_ptr MultiRecordable::ReleaseRecordable( const LogRecordProcessor &processor) noexcept { auto i = recordables_.find(MakeKey(processor)); if (i != recordables_.end()) { - nostd::unique_ptr result(i->second.release()); + std::unique_ptr result(i->second.release()); recordables_.erase(MakeKey(processor)); return result; } - return nostd::unique_ptr(nullptr); + return std::unique_ptr(nullptr); } void MultiRecordable::SetTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept diff --git a/sdk/src/logs/read_write_log_record.cc b/sdk/src/logs/read_write_log_record.cc index ed87c55080..4e4ca5993a 100644 --- a/sdk/src/logs/read_write_log_record.cc +++ b/sdk/src/logs/read_write_log_record.cc @@ -69,7 +69,7 @@ void ReadWriteLogRecord::SetTraceId(const opentelemetry::trace::TraceId &trace_i { if (!trace_state_) { - trace_state_ = nostd::unique_ptr(new TraceState()); + trace_state_ = std::unique_ptr(new TraceState()); } trace_state_->trace_id = trace_id; @@ -90,7 +90,7 @@ void ReadWriteLogRecord::SetSpanId(const opentelemetry::trace::SpanId &span_id) { if (!trace_state_) { - trace_state_ = nostd::unique_ptr(new TraceState()); + trace_state_ = std::unique_ptr(new TraceState()); } trace_state_->span_id = span_id; @@ -111,7 +111,7 @@ void ReadWriteLogRecord::SetTraceFlags(const opentelemetry::trace::TraceFlags &t { if (!trace_state_) { - trace_state_ = nostd::unique_ptr(new TraceState()); + trace_state_ = std::unique_ptr(new TraceState()); } trace_state_->trace_flags = trace_flags; diff --git a/sdk/src/logs/readable_log_record.cc b/sdk/src/logs/readable_log_record.cc index e962fb665d..9ed5ca7ae7 100644 --- a/sdk/src/logs/readable_log_record.cc +++ b/sdk/src/logs/readable_log_record.cc @@ -29,7 +29,7 @@ const opentelemetry::sdk::instrumentationscope::InstrumentationScope & ReadableLogRecord::GetDefaultInstrumentationScope() noexcept { // FIXME: Use shared default instrumentation scope? - static nostd::unique_ptr + static std::unique_ptr default_scope = opentelemetry::sdk::instrumentationscope::InstrumentationScope::Create( "otel-cpp", OPENTELEMETRY_SDK_VERSION, "https://opentelemetry.io/schemas/1.15.0"); return *default_scope; diff --git a/sdk/src/logs/simple_log_record_processor.cc b/sdk/src/logs/simple_log_record_processor.cc index 3a7f25ed13..ef923bc590 100644 --- a/sdk/src/logs/simple_log_record_processor.cc +++ b/sdk/src/logs/simple_log_record_processor.cc @@ -16,11 +16,11 @@ namespace logs * Initialize a simple log processor. * @param exporter the configured exporter where log records are sent */ -SimpleLogRecordProcessor::SimpleLogRecordProcessor(nostd::unique_ptr &&exporter) +SimpleLogRecordProcessor::SimpleLogRecordProcessor(std::unique_ptr &&exporter) : exporter_(std::move(exporter)), is_shutdown_(false) {} -nostd::unique_ptr SimpleLogRecordProcessor::MakeRecordable() noexcept +std::unique_ptr SimpleLogRecordProcessor::MakeRecordable() noexcept { return exporter_->MakeRecordable(); } @@ -29,9 +29,9 @@ nostd::unique_ptr SimpleLogRecordProcessor::MakeRecordable() noexcep * Batches the log record it receives in a batch of 1 and immediately sends it * to the configured exporter */ -void SimpleLogRecordProcessor::OnEmit(nostd::unique_ptr &&record) noexcept +void SimpleLogRecordProcessor::OnEmit(std::unique_ptr &&record) noexcept { - nostd::span> batch(&record, 1); + nostd::span> batch(&record, 1); // Get lock to ensure Export() is never called concurrently const std::lock_guard locked(lock_); diff --git a/sdk/src/logs/simple_log_record_processor_factory.cc b/sdk/src/logs/simple_log_record_processor_factory.cc index e25dfd261b..213f61e16c 100644 --- a/sdk/src/logs/simple_log_record_processor_factory.cc +++ b/sdk/src/logs/simple_log_record_processor_factory.cc @@ -12,11 +12,10 @@ namespace sdk namespace logs { -nostd::unique_ptr SimpleLogRecordProcessorFactory::Create( - nostd::unique_ptr &&exporter) +std::unique_ptr SimpleLogRecordProcessorFactory::Create( + std::unique_ptr &&exporter) { - nostd::unique_ptr processor( - new SimpleLogRecordProcessor(std::move(exporter))); + std::unique_ptr processor(new SimpleLogRecordProcessor(std::move(exporter))); return processor; } diff --git a/sdk/test/logs/batch_log_record_processor_test.cc b/sdk/test/logs/batch_log_record_processor_test.cc index abd018e601..8ecbe4cd21 100644 --- a/sdk/test/logs/batch_log_record_processor_test.cc +++ b/sdk/test/logs/batch_log_record_processor_test.cc @@ -70,7 +70,7 @@ class MockLogRecordable final : public opentelemetry::sdk::logs::Recordable class MockLogExporter final : public LogRecordExporter { public: - MockLogExporter(std::shared_ptr>> logs_received, + MockLogExporter(std::shared_ptr>> logs_received, std::shared_ptr> is_shutdown, std::shared_ptr> is_export_completed, const std::chrono::milliseconds export_delay = std::chrono::milliseconds(0)) @@ -80,21 +80,21 @@ class MockLogExporter final : public LogRecordExporter export_delay_(export_delay) {} - nostd::unique_ptr MakeRecordable() noexcept override + std::unique_ptr MakeRecordable() noexcept override { - return nostd::unique_ptr(new MockLogRecordable()); + return std::unique_ptr(new MockLogRecordable()); } // Export method stores the logs received into a shared list of record names ExportResult Export( - const opentelemetry::nostd::span> &records) noexcept override + const opentelemetry::nostd::span> &records) noexcept override { *is_export_completed_ = false; // Meant exclusively to test scheduled_delay_millis for (auto &record : records) { auto log = - nostd::unique_ptr(static_cast(record.release())); + std::unique_ptr(static_cast(record.release())); if (log != nullptr) { logs_received_->push_back(std::move(log)); @@ -118,7 +118,7 @@ class MockLogExporter final : public LogRecordExporter } private: - std::shared_ptr>> logs_received_; + std::shared_ptr>> logs_received_; std::shared_ptr> is_shutdown_; std::shared_ptr> is_export_completed_; const std::chrono::milliseconds export_delay_; @@ -134,7 +134,7 @@ class BatchLogRecordProcessorTest : public testing::Test // ::testing::Test // returns a batch log processor that received a batch of log records, a shared pointer to a // is_shutdown flag, and the processor configuration options (default if unspecified) std::shared_ptr GetMockProcessor( - std::shared_ptr>> logs_received, + std::shared_ptr>> logs_received, std::shared_ptr> is_shutdown, std::shared_ptr> is_export_completed = std::shared_ptr>(new std::atomic(false)), @@ -144,7 +144,7 @@ class BatchLogRecordProcessorTest : public testing::Test // ::testing::Test const size_t max_export_batch_size = 512) { return std::shared_ptr(new BatchLogRecordProcessor( - nostd::unique_ptr( + std::unique_ptr( new MockLogExporter(logs_received, is_shutdown, is_export_completed, export_delay)), max_queue_size, scheduled_delay_millis, max_export_batch_size)); } @@ -153,8 +153,8 @@ class BatchLogRecordProcessorTest : public testing::Test // ::testing::Test TEST_F(BatchLogRecordProcessorTest, TestShutdown) { // initialize a batch log processor with the test exporter - std::shared_ptr>> logs_received( - new std::vector>); + std::shared_ptr>> logs_received( + new std::vector>); std::shared_ptr> is_shutdown(new std::atomic(false)); auto batch_processor = GetMockProcessor(logs_received, is_shutdown); @@ -191,8 +191,8 @@ TEST_F(BatchLogRecordProcessorTest, TestShutdown) TEST_F(BatchLogRecordProcessorTest, TestForceFlush) { std::shared_ptr> is_shutdown(new std::atomic(false)); - std::shared_ptr>> logs_received( - new std::vector>); + std::shared_ptr>> logs_received( + new std::vector>); auto batch_processor = GetMockProcessor(logs_received, is_shutdown); const int num_logs = 2048; @@ -234,8 +234,8 @@ TEST_F(BatchLogRecordProcessorTest, TestManyLogsLoss) /* Test that when exporting more than max_queue_size logs, some are most likely lost*/ std::shared_ptr> is_shutdown(new std::atomic(false)); - std::shared_ptr>> logs_received( - new std::vector>); + std::shared_ptr>> logs_received( + new std::vector>); const int max_queue_size = 4096; @@ -260,8 +260,8 @@ TEST_F(BatchLogRecordProcessorTest, TestManyLogsLossLess) /* Test that no logs are lost when sending max_queue_size logs */ std::shared_ptr> is_shutdown(new std::atomic(false)); - std::shared_ptr>> logs_received( - new std::vector>); + std::shared_ptr>> logs_received( + new std::vector>); auto batch_processor = GetMockProcessor(logs_received, is_shutdown); const int num_logs = 2048; @@ -289,8 +289,8 @@ TEST_F(BatchLogRecordProcessorTest, TestScheduledDelayMillis) std::shared_ptr> is_shutdown(new std::atomic(false)); std::shared_ptr> is_export_completed(new std::atomic(false)); - std::shared_ptr>> logs_received( - new std::vector>); + std::shared_ptr>> logs_received( + new std::vector>); const std::chrono::milliseconds export_delay(0); const std::chrono::milliseconds scheduled_delay_millis(2000); diff --git a/sdk/test/logs/logger_provider_sdk_test.cc b/sdk/test/logs/logger_provider_sdk_test.cc index 04d7108194..9339560377 100644 --- a/sdk/test/logs/logger_provider_sdk_test.cc +++ b/sdk/test/logs/logger_provider_sdk_test.cc @@ -109,12 +109,12 @@ class DummyLogRecordable final : public opentelemetry::sdk::logs::Recordable class DummyProcessor : public LogRecordProcessor { - nostd::unique_ptr MakeRecordable() noexcept override + std::unique_ptr MakeRecordable() noexcept override { - return nostd::unique_ptr(new DummyLogRecordable()); + return std::unique_ptr(new DummyLogRecordable()); } - void OnEmit(nostd::unique_ptr && /* record */) noexcept override {} + void OnEmit(std::unique_ptr && /* record */) noexcept override {} bool ForceFlush(std::chrono::microseconds /* timeout */) noexcept override { return true; } bool Shutdown(std::chrono::microseconds /* timeout */) noexcept override { return true; } }; @@ -129,9 +129,9 @@ TEST(LoggerProviderSDK, GetResource) TEST(LoggerProviderSDK, Shutdown) { - nostd::unique_ptr processor(new SimpleLogRecordProcessor(nullptr)); + std::unique_ptr processor(new SimpleLogRecordProcessor(nullptr)); SimpleLogRecordProcessor *processor_ptr = processor.get(); - std::vector> processors; + std::vector> processors; processors.push_back(std::move(processor)); LoggerProvider lp(std::make_shared(std::move(processors))); @@ -145,8 +145,8 @@ TEST(LoggerProviderSDK, Shutdown) TEST(LoggerProviderSDK, ForceFlush) { - nostd::unique_ptr processor(new SimpleLogRecordProcessor(nullptr)); - std::vector> processors; + std::unique_ptr processor(new SimpleLogRecordProcessor(nullptr)); + std::vector> processors; processors.push_back(std::move(processor)); LoggerProvider lp(std::make_shared(std::move(processors))); diff --git a/sdk/test/logs/logger_sdk_test.cc b/sdk/test/logs/logger_sdk_test.cc index ede74cd8ef..b6b597a887 100644 --- a/sdk/test/logs/logger_sdk_test.cc +++ b/sdk/test/logs/logger_sdk_test.cc @@ -96,14 +96,14 @@ class MockProcessor final : public LogRecordProcessor : record_received_(record_received) {} - nostd::unique_ptr MakeRecordable() noexcept override + std::unique_ptr MakeRecordable() noexcept override { - return nostd::unique_ptr(new MockLogRecordable()); + return std::unique_ptr(new MockLogRecordable()); } // OnEmit stores the record it receives into the shared_ptr recordable passed into its // constructor - void OnEmit(nostd::unique_ptr &&record) noexcept override + void OnEmit(std::unique_ptr &&record) noexcept override { // Cast the recordable received into a concrete MockLogRecordable type auto copy = @@ -139,7 +139,7 @@ TEST(LoggerSDK, LogToAProcessor) ASSERT_EQ(sdk_logger->GetInstrumentationScope().GetSchemaURL(), schema_url); // Set a processor for the LoggerProvider auto shared_recordable = std::shared_ptr(new MockLogRecordable()); - lp->AddProcessor(nostd::unique_ptr( + lp->AddProcessor(std::unique_ptr( new MockProcessor(shared_recordable))); // Check that the recordable created by the Log() statement is set properly diff --git a/sdk/test/logs/simple_log_record_processor_test.cc b/sdk/test/logs/simple_log_record_processor_test.cc index 0e6c276aa4..2f06d1944a 100644 --- a/sdk/test/logs/simple_log_record_processor_test.cc +++ b/sdk/test/logs/simple_log_record_processor_test.cc @@ -71,26 +71,26 @@ class TestExporter final : public LogRecordExporter { public: TestExporter(int *shutdown_counter, - std::shared_ptr>> logs_received, + std::shared_ptr>> logs_received, size_t *batch_size_received) : shutdown_counter_(shutdown_counter), logs_received_(logs_received), batch_size_received(batch_size_received) {} - nostd::unique_ptr MakeRecordable() noexcept override + std::unique_ptr MakeRecordable() noexcept override { - return nostd::unique_ptr(new TestLogRecordable()); + return std::unique_ptr(new TestLogRecordable()); } // Stores the names of the log records this exporter receives to an internal list - ExportResult Export(const nostd::span> &records) noexcept override + ExportResult Export(const nostd::span> &records) noexcept override { *batch_size_received = records.size(); for (auto &record : records) { auto log_record = - nostd::unique_ptr(static_cast(record.release())); + std::unique_ptr(static_cast(record.release())); if (log_record != nullptr) { @@ -109,7 +109,7 @@ class TestExporter final : public LogRecordExporter private: int *shutdown_counter_; - std::shared_ptr>> logs_received_; + std::shared_ptr>> logs_received_; size_t *batch_size_received; }; @@ -118,11 +118,11 @@ class TestExporter final : public LogRecordExporter TEST(SimpleLogRecordProcessorTest, SendReceivedLogsToExporter) { // Create a simple processor with a TestExporter attached - std::shared_ptr>> logs_received( - new std::vector>); + std::shared_ptr>> logs_received( + new std::vector>); size_t batch_size_received = 0; - nostd::unique_ptr exporter( + std::unique_ptr exporter( new TestExporter(nullptr, logs_received, &batch_size_received)); SimpleLogRecordProcessor processor(std::move(exporter)); @@ -153,7 +153,7 @@ TEST(SimpleLogRecordProcessorTest, ShutdownCalledOnce) // Create a TestExporter int num_shutdowns = 0; - nostd::unique_ptr exporter(new TestExporter(&num_shutdowns, nullptr, nullptr)); + std::unique_ptr exporter(new TestExporter(&num_shutdowns, nullptr, nullptr)); // Create a processor with the previous test exporter SimpleLogRecordProcessor processor(std::move(exporter)); @@ -174,13 +174,13 @@ class FailShutDownExporter final : public LogRecordExporter public: FailShutDownExporter() {} - nostd::unique_ptr MakeRecordable() noexcept override + std::unique_ptr MakeRecordable() noexcept override { - return nostd::unique_ptr(new TestLogRecordable()); + return std::unique_ptr(new TestLogRecordable()); } ExportResult Export( - const nostd::span> & /* records */) noexcept override + const nostd::span> & /* records */) noexcept override { return ExportResult::kSuccess; } @@ -191,7 +191,7 @@ class FailShutDownExporter final : public LogRecordExporter // Tests for when when processor should fail to shutdown TEST(SimpleLogRecordProcessorTest, ShutDownFail) { - nostd::unique_ptr exporter(new FailShutDownExporter()); + std::unique_ptr exporter(new FailShutDownExporter()); SimpleLogRecordProcessor processor(std::move(exporter)); // Expect failure result when exporter fails to shutdown