From 6435d87698c726b1ace7ebc62f0935ece247da17 Mon Sep 17 00:00:00 2001 From: owent Date: Tue, 1 Nov 2022 16:10:22 +0800 Subject: [PATCH 1/2] + Rename `LogProcessor` to `LogRecordProcessor` + Rename `LogExporter` to `LogRecordExporter` + Move `*log_processor*` to `*log_record_processor*` + Move `*log_exporter*` to `*log_record_exporter*` Signed-off-by: owent --- cmake/opentelemetry-cpp-config.cmake.in | 62 +++++++++---------- examples/otlp/BUILD | 4 +- examples/otlp/grpc_log_main.cc | 4 +- examples/otlp/http_log_main.cc | 6 +- exporters/elasticsearch/BUILD | 12 ++-- exporters/elasticsearch/CMakeLists.txt | 16 ++--- ...og_exporter.h => es_log_record_exporter.h} | 2 +- ..._exporter.cc => es_log_record_exporter.cc} | 2 +- ...test.cc => es_log_record_exporter_test.cc} | 10 +-- exporters/ostream/BUILD | 8 +-- exporters/ostream/CMakeLists.txt | 6 +- .../{log_exporter.h => log_record_exporter.h} | 2 +- ...log_exporter.cc => log_record_exporter.cc} | 2 +- exporters/ostream/test/ostream_log_test.cc | 20 +++--- exporters/otlp/BUILD | 46 +++++++------- exporters/otlp/CMakeLists.txt | 52 ++++++++-------- ...rter.h => otlp_grpc_log_record_exporter.h} | 2 +- ...> otlp_grpc_log_record_exporter_factory.h} | 4 +- ...rter.h => otlp_http_log_record_exporter.h} | 4 +- ...> otlp_http_log_record_exporter_factory.h} | 6 +- ...> otlp_http_log_record_exporter_options.h} | 0 ...er.cc => otlp_grpc_log_record_exporter.cc} | 2 +- ... otlp_grpc_log_record_exporter_factory.cc} | 11 ++-- .../src/otlp_http_log_exporter_factory.cc | 33 ---------- ...er.cc => otlp_http_log_record_exporter.cc} | 2 +- .../otlp_http_log_record_exporter_factory.cc | 34 ++++++++++ ..._grpc_log_record_exporter_factory_test.cc} | 4 +- ... => otlp_grpc_log_record_exporter_test.cc} | 10 +-- ..._http_log_record_exporter_factory_test.cc} | 6 +- ... => otlp_http_log_record_exporter_test.cc} | 21 ++++--- ...ocessor.h => batch_log_record_processor.h} | 14 ++--- ...h => batch_log_record_processor_factory.h} | 6 +- ...h => batch_log_record_processor_options.h} | 0 sdk/include/opentelemetry/sdk/logs/exporter.h | 8 +-- .../opentelemetry/sdk/logs/logger_context.h | 8 +-- .../sdk/logs/logger_context_factory.h | 4 +- .../opentelemetry/sdk/logs/logger_provider.h | 6 +- .../sdk/logs/logger_provider_factory.h | 8 +-- ...ocessor.h => multi_log_record_processor.h} | 8 +-- ...h => multi_log_record_processor_factory.h} | 4 +- .../opentelemetry/sdk/logs/multi_recordable.h | 7 ++- .../opentelemetry/sdk/logs/processor.h | 4 +- ...cessor.h => simple_log_record_processor.h} | 10 +-- ... => simple_log_record_processor_factory.h} | 2 +- sdk/src/logs/CMakeLists.txt | 12 ++-- sdk/src/logs/batch_log_processor_factory.cc | 26 -------- ...essor.cc => batch_log_record_processor.cc} | 6 +- .../batch_log_record_processor_factory.cc | 27 ++++++++ sdk/src/logs/logger_context.cc | 10 +-- sdk/src/logs/logger_context_factory.cc | 4 +- sdk/src/logs/logger_provider.cc | 12 ++-- sdk/src/logs/logger_provider_factory.cc | 8 +-- sdk/src/logs/multi_log_processor_factory.cc | 30 --------- ...essor.cc => multi_log_record_processor.cc} | 6 +- .../multi_log_record_processor_factory.cc | 30 +++++++++ sdk/src/logs/multi_recordable.cc | 8 +-- sdk/src/logs/simple_log_processor_factory.cc | 25 -------- ...ssor.cc => simple_log_record_processor.cc} | 4 +- .../simple_log_record_processor_factory.cc | 25 ++++++++ sdk/test/logs/BUILD | 8 +-- sdk/test/logs/CMakeLists.txt | 5 +- ....cc => batch_log_record_processor_test.cc} | 10 +-- sdk/test/logs/logger_provider_sdk_test.cc | 8 +-- sdk/test/logs/logger_sdk_test.cc | 4 +- ...cc => simple_log_record_processor_test.cc} | 6 +- 65 files changed, 384 insertions(+), 372 deletions(-) rename exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/{es_log_exporter.h => es_log_record_exporter.h} (99%) rename exporters/elasticsearch/src/{es_log_exporter.cc => es_log_record_exporter.cc} (99%) rename exporters/elasticsearch/test/{es_log_exporter_test.cc => es_log_record_exporter_test.cc} (85%) rename exporters/ostream/include/opentelemetry/exporters/ostream/{log_exporter.h => log_record_exporter.h} (98%) rename exporters/ostream/src/{log_exporter.cc => log_record_exporter.cc} (98%) rename exporters/otlp/include/opentelemetry/exporters/otlp/{otlp_grpc_log_exporter.h => otlp_grpc_log_record_exporter.h} (99%) rename exporters/otlp/include/opentelemetry/exporters/otlp/{otlp_grpc_log_exporter_factory.h => otlp_grpc_log_record_exporter_factory.h} (80%) rename exporters/otlp/include/opentelemetry/exporters/otlp/{otlp_http_log_exporter.h => otlp_http_log_record_exporter.h} (95%) rename exporters/otlp/include/opentelemetry/exporters/otlp/{otlp_http_log_exporter_factory.h => otlp_http_log_record_exporter_factory.h} (70%) rename exporters/otlp/include/opentelemetry/exporters/otlp/{otlp_http_log_exporter_options.h => otlp_http_log_record_exporter_options.h} (100%) rename exporters/otlp/src/{otlp_grpc_log_exporter.cc => otlp_grpc_log_record_exporter.cc} (97%) rename exporters/otlp/src/{otlp_grpc_log_exporter_factory.cc => otlp_grpc_log_record_exporter_factory.cc} (51%) delete mode 100644 exporters/otlp/src/otlp_http_log_exporter_factory.cc rename exporters/otlp/src/{otlp_http_log_exporter.cc => otlp_http_log_record_exporter.cc} (98%) create mode 100644 exporters/otlp/src/otlp_http_log_record_exporter_factory.cc rename exporters/otlp/test/{otlp_grpc_log_exporter_factory_test.cc => otlp_grpc_log_record_exporter_factory_test.cc} (83%) rename exporters/otlp/test/{otlp_grpc_log_exporter_test.cc => otlp_grpc_log_record_exporter_test.cc} (95%) rename exporters/otlp/test/{otlp_http_log_exporter_factory_test.cc => otlp_http_log_record_exporter_factory_test.cc} (79%) rename exporters/otlp/test/{otlp_http_log_exporter_test.cc => otlp_http_log_record_exporter_test.cc} (97%) rename sdk/include/opentelemetry/sdk/logs/{batch_log_processor.h => batch_log_record_processor.h} (90%) rename sdk/include/opentelemetry/sdk/logs/{batch_log_processor_factory.h => batch_log_record_processor_factory.h} (66%) rename sdk/include/opentelemetry/sdk/logs/{batch_log_processor_options.h => batch_log_record_processor_options.h} (100%) rename sdk/include/opentelemetry/sdk/logs/{multi_log_processor.h => multi_log_record_processor.h} (87%) rename sdk/include/opentelemetry/sdk/logs/{multi_log_processor_factory.h => multi_log_record_processor_factory.h} (78%) rename sdk/include/opentelemetry/sdk/logs/{simple_log_processor.h => simple_log_record_processor.h} (82%) rename sdk/include/opentelemetry/sdk/logs/{simple_log_processor_factory.h => simple_log_record_processor_factory.h} (83%) delete mode 100644 sdk/src/logs/batch_log_processor_factory.cc rename sdk/src/logs/{batch_log_processor.cc => batch_log_record_processor.cc} (97%) create mode 100644 sdk/src/logs/batch_log_record_processor_factory.cc delete mode 100644 sdk/src/logs/multi_log_processor_factory.cc rename sdk/src/logs/{multi_log_processor.cc => multi_log_record_processor.cc} (95%) create mode 100644 sdk/src/logs/multi_log_record_processor_factory.cc delete mode 100644 sdk/src/logs/simple_log_processor_factory.cc rename sdk/src/logs/{simple_log_processor.cc => simple_log_record_processor.cc} (91%) create mode 100644 sdk/src/logs/simple_log_record_processor_factory.cc rename sdk/test/logs/{batch_log_processor_test.cc => batch_log_record_processor_test.cc} (96%) rename sdk/test/logs/{simple_log_processor_test.cc => simple_log_record_processor_test.cc} (96%) diff --git a/cmake/opentelemetry-cpp-config.cmake.in b/cmake/opentelemetry-cpp-config.cmake.in index 98d997b555..11a8e0c27b 100644 --- a/cmake/opentelemetry-cpp-config.cmake.in +++ b/cmake/opentelemetry-cpp-config.cmake.in @@ -20,33 +20,33 @@ # OPENTELEMETRY_VERSION - Version of opentelemetry-cpp. # # :: -# opentelemetry-cpp::api - Imported target of opentelemetry-cpp::api -# opentelemetry-cpp::sdk - Imported target of opentelemetry-cpp::sdk -# opentelemetry-cpp::ext - Imported target of opentelemetry-cpp::ext -# opentelemetry-cpp::version - Imported target of opentelemetry-cpp::version -# opentelemetry-cpp::common - Imported target of opentelemetry-cpp::common -# opentelemetry-cpp::trace - Imported target of opentelemetry-cpp::trace -# opentelemetry-cpp::metrics - Imported target of opentelemetry-cpp::metrics -# opentelemetry-cpp::logs - Imported target of opentelemetry-cpp::logs -# opentelemetry-cpp::in_memory_span_exporter - Imported target of opentelemetry-cpp::in_memory_span_exporter -# opentelemetry-cpp::otlp_grpc_client - Imported target of opentelemetry-cpp::otlp_grpc_client -# opentelemetry-cpp::otlp_recordable - Imported target of opentelemetry-cpp::otlp_recordable -# opentelemetry-cpp::otlp_grpc_exporter - Imported target of opentelemetry-cpp::otlp_grpc_exporter -# opentelemetry-cpp::otlp_grpc_log_exporter - Imported target of opentelemetry-cpp::otlp_grpc_log_exporter -# opentelemetry-cpp::otlp_grpc_metrics_exporter - Imported target of opentelemetry-cpp::otlp_grpc_metrics_exporter -# opentelemetry-cpp::otlp_http_client - Imported target of opentelemetry-cpp::otlp_http_client -# opentelemetry-cpp::otlp_http_exporter - Imported target of opentelemetry-cpp::otlp_http_exporter -# opentelemetry-cpp::otlp_http_log_exporter - Imported target of opentelemetry-cpp::otlp_http_log_exporter -# opentelemetry-cpp::otlp_http_metric_exporter - Imported target of opentelemetry-cpp::otlp_http_metric_exporter -# opentelemetry-cpp::ostream_log_exporter - Imported target of opentelemetry-cpp::ostream_log_exporter -# opentelemetry-cpp::ostream_metrics_exporter - Imported target of opentelemetry-cpp::ostream_metrics_exporter -# opentelemetry-cpp::ostream_span_exporter - Imported target of opentelemetry-cpp::ostream_span_exporter -# opentelemetry-cpp::prometheus_exporter_deprecated - Imported target of opentelemetry-cpp::prometheus_exporter_deprecated -# opentelemetry-cpp::elasticsearch_log_exporter - Imported target of opentelemetry-cpp::elasticsearch_log_exporter -# opentelemetry-cpp::etw_exporter - Imported target of opentelemetry-cpp::etw_exporter -# opentelemetry-cpp::jaeger_trace_exporter - Imported target of opentelemetry-cpp::jaeger_trace_exporter -# opentelemetry-cpp::zpages - Imported target of opentelemetry-cpp::zpages -# opentelemetry-cpp::http_client_curl - Imported target of opentelemetry-cpp::http_client_curl +# opentelemetry-cpp::api - Imported target of opentelemetry-cpp::api +# opentelemetry-cpp::sdk - Imported target of opentelemetry-cpp::sdk +# opentelemetry-cpp::ext - Imported target of opentelemetry-cpp::ext +# opentelemetry-cpp::version - Imported target of opentelemetry-cpp::version +# opentelemetry-cpp::common - Imported target of opentelemetry-cpp::common +# opentelemetry-cpp::trace - Imported target of opentelemetry-cpp::trace +# opentelemetry-cpp::metrics - Imported target of opentelemetry-cpp::metrics +# opentelemetry-cpp::logs - Imported target of opentelemetry-cpp::logs +# opentelemetry-cpp::in_memory_span_exporter - Imported target of opentelemetry-cpp::in_memory_span_exporter +# opentelemetry-cpp::otlp_grpc_client - Imported target of opentelemetry-cpp::otlp_grpc_client +# opentelemetry-cpp::otlp_recordable - Imported target of opentelemetry-cpp::otlp_recordable +# opentelemetry-cpp::otlp_grpc_exporter - Imported target of opentelemetry-cpp::otlp_grpc_exporter +# opentelemetry-cpp::otlp_grpc_log_record_exporter - Imported target of opentelemetry-cpp::otlp_grpc_log_record_exporter +# opentelemetry-cpp::otlp_grpc_metrics_exporter - Imported target of opentelemetry-cpp::otlp_grpc_metrics_exporter +# opentelemetry-cpp::otlp_http_client - Imported target of opentelemetry-cpp::otlp_http_client +# opentelemetry-cpp::otlp_http_exporter - Imported target of opentelemetry-cpp::otlp_http_exporter +# opentelemetry-cpp::otlp_http_log_record_exporter - Imported target of opentelemetry-cpp::otlp_http_log_record_exporter +# opentelemetry-cpp::otlp_http_metric_exporter - Imported target of opentelemetry-cpp::otlp_http_metric_exporter +# opentelemetry-cpp::ostream_log_record_exporter - Imported target of opentelemetry-cpp::ostream_log_record_exporter +# opentelemetry-cpp::ostream_metrics_exporter - Imported target of opentelemetry-cpp::ostream_metrics_exporter +# opentelemetry-cpp::ostream_span_exporter - Imported target of opentelemetry-cpp::ostream_span_exporter +# opentelemetry-cpp::prometheus_exporter_deprecated - Imported target of opentelemetry-cpp::prometheus_exporter_deprecated +# opentelemetry-cpp::elasticsearch_log_record_exporter - Imported target of opentelemetry-cpp::elasticsearch_log_record_exporter +# opentelemetry-cpp::etw_exporter - Imported target of opentelemetry-cpp::etw_exporter +# opentelemetry-cpp::jaeger_trace_exporter - Imported target of opentelemetry-cpp::jaeger_trace_exporter +# opentelemetry-cpp::zpages - Imported target of opentelemetry-cpp::zpages +# opentelemetry-cpp::http_client_curl - Imported target of opentelemetry-cpp::http_client_curl # # ============================================================================= @@ -88,17 +88,17 @@ set(_OPENTELEMETRY_CPP_LIBRARIES_TEST_TARGETS otlp_recordable otlp_grpc_client otlp_grpc_exporter - otlp_grpc_log_exporter + otlp_grpc_log_record_exporter otlp_grpc_metrics_exporter otlp_http_client otlp_http_exporter - otlp_http_log_exporter + otlp_http_log_record_exporter otlp_http_metric_exporter - ostream_log_exporter + ostream_log_record_exporter ostream_metrics_exporter ostream_span_exporter prometheus_exporter - elasticsearch_log_exporter + elasticsearch_log_record_exporter etw_exporter jaeger_trace_exporter zpages diff --git a/examples/otlp/BUILD b/examples/otlp/BUILD index 26dc26d7c9..9ed87939f6 100644 --- a/examples/otlp/BUILD +++ b/examples/otlp/BUILD @@ -48,7 +48,7 @@ cc_binary( "//api", "//examples/common/logs_foo_library:common_logs_foo_library", "//exporters/otlp:otlp_http_exporter", - "//exporters/otlp:otlp_http_log_exporter", + "//exporters/otlp:otlp_http_log_record_exporter", "//sdk/src/trace", ], ) @@ -67,7 +67,7 @@ cc_binary( "//api", "//examples/common/logs_foo_library:common_logs_foo_library", "//exporters/otlp:otlp_grpc_exporter", - "//exporters/otlp:otlp_grpc_log_exporter", + "//exporters/otlp:otlp_grpc_log_record_exporter", "//sdk/src/trace", ], ) diff --git a/examples/otlp/grpc_log_main.cc b/examples/otlp/grpc_log_main.cc index b8f7441b71..d5705bcd8d 100644 --- a/examples/otlp/grpc_log_main.cc +++ b/examples/otlp/grpc_log_main.cc @@ -3,10 +3,10 @@ #ifdef ENABLE_LOGS_PREVIEW # include "opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_log_exporter_factory.h" +# include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h" # include "opentelemetry/logs/provider.h" # include "opentelemetry/sdk/logs/logger_provider_factory.h" -# include "opentelemetry/sdk/logs/simple_log_processor_factory.h" +# include "opentelemetry/sdk/logs/simple_log_record_processor_factory.h" # include "opentelemetry/sdk/trace/simple_processor_factory.h" # include "opentelemetry/sdk/trace/tracer_provider_factory.h" # include "opentelemetry/trace/provider.h" diff --git a/examples/otlp/http_log_main.cc b/examples/otlp/http_log_main.cc index a764252aac..5d1471516c 100644 --- a/examples/otlp/http_log_main.cc +++ b/examples/otlp/http_log_main.cc @@ -3,11 +3,11 @@ #ifdef ENABLE_LOGS_PREVIEW # include "opentelemetry/exporters/otlp/otlp_http_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_http_log_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_http_log_exporter_options.h" +# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h" +# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" # include "opentelemetry/logs/provider.h" # include "opentelemetry/sdk/logs/logger_provider_factory.h" -# include "opentelemetry/sdk/logs/simple_log_processor_factory.h" +# include "opentelemetry/sdk/logs/simple_log_record_processor_factory.h" # include "opentelemetry/sdk/trace/simple_processor_factory.h" # include "opentelemetry/sdk/trace/tracer_provider_factory.h" # include "opentelemetry/trace/provider.h" diff --git a/exporters/elasticsearch/BUILD b/exporters/elasticsearch/BUILD index 78ff94d466..a13c881b0b 100644 --- a/exporters/elasticsearch/BUILD +++ b/exporters/elasticsearch/BUILD @@ -1,12 +1,12 @@ package(default_visibility = ["//visibility:public"]) cc_library( - name = "es_log_exporter", + name = "es_log_record_exporter", srcs = [ - "src/es_log_exporter.cc", + "src/es_log_record_exporter.cc", ], hdrs = [ - "include/opentelemetry/exporters/elasticsearch/es_log_exporter.h", + "include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h", "include/opentelemetry/exporters/elasticsearch/es_log_recordable.h", ], linkopts = select({ @@ -29,14 +29,14 @@ cc_library( ) cc_test( - name = "es_log_exporter_test", - srcs = ["test/es_log_exporter_test.cc"], + name = "es_log_record_exporter_test", + srcs = ["test/es_log_record_exporter_test.cc"], tags = [ "es", "test", ], deps = [ - ":es_log_exporter", + ":es_log_record_exporter", "@com_google_googletest//:gtest_main", "@curl", ], diff --git a/exporters/elasticsearch/CMakeLists.txt b/exporters/elasticsearch/CMakeLists.txt index ed6488316c..ddae27cb71 100644 --- a/exporters/elasticsearch/CMakeLists.txt +++ b/exporters/elasticsearch/CMakeLists.txt @@ -1,7 +1,8 @@ -add_library(opentelemetry_exporter_elasticsearch_logs src/es_log_exporter.cc) +add_library(opentelemetry_exporter_elasticsearch_logs + src/es_log_record_exporter.cc) set_target_properties(opentelemetry_exporter_elasticsearch_logs - PROPERTIES EXPORT_NAME elasticsearch_log_exporter) + PROPERTIES EXPORT_NAME elasticsearch_log_record_exporter) target_include_directories( opentelemetry_exporter_elasticsearch_logs @@ -28,14 +29,15 @@ install( PATTERN "es_log_recordable.h" EXCLUDE) if(BUILD_TESTING) - add_executable(es_log_exporter_test test/es_log_exporter_test.cc) + add_executable(es_log_record_exporter_test + test/es_log_record_exporter_test.cc) target_link_libraries( - es_log_exporter_test ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} - opentelemetry_exporter_elasticsearch_logs) + es_log_record_exporter_test ${GTEST_BOTH_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} opentelemetry_exporter_elasticsearch_logs) gtest_add_tests( - TARGET es_log_exporter_test + TARGET es_log_record_exporter_test TEST_PREFIX exporter. - TEST_LIST es_log_exporter_test) + TEST_LIST es_log_record_exporter_test) endif() # BUILD_TESTING diff --git a/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_exporter.h b/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h similarity index 99% rename from exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_exporter.h rename to exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h index 9b75c04eb4..2768dd9dc9 100644 --- a/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_exporter.h +++ b/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h @@ -61,7 +61,7 @@ struct ElasticsearchExporterOptions /** * The ElasticsearchLogExporter exports logs to Elasticsearch in JSON format */ -class ElasticsearchLogExporter final : public opentelemetry::sdk::logs::LogExporter +class ElasticsearchLogExporter final : public opentelemetry::sdk::logs::LogRecordExporter { public: /** diff --git a/exporters/elasticsearch/src/es_log_exporter.cc b/exporters/elasticsearch/src/es_log_record_exporter.cc similarity index 99% rename from exporters/elasticsearch/src/es_log_exporter.cc rename to exporters/elasticsearch/src/es_log_record_exporter.cc index 13798ae300..c3f4013412 100644 --- a/exporters/elasticsearch/src/es_log_exporter.cc +++ b/exporters/elasticsearch/src/es_log_record_exporter.cc @@ -7,7 +7,7 @@ # include # include -# include "opentelemetry/exporters/elasticsearch/es_log_exporter.h" +# include "opentelemetry/exporters/elasticsearch/es_log_record_exporter.h" # include "opentelemetry/exporters/elasticsearch/es_log_recordable.h" # include "opentelemetry/sdk_config.h" diff --git a/exporters/elasticsearch/test/es_log_exporter_test.cc b/exporters/elasticsearch/test/es_log_record_exporter_test.cc similarity index 85% rename from exporters/elasticsearch/test/es_log_exporter_test.cc rename to exporters/elasticsearch/test/es_log_record_exporter_test.cc index e256c969e7..099ae3fae9 100644 --- a/exporters/elasticsearch/test/es_log_exporter_test.cc +++ b/exporters/elasticsearch/test/es_log_record_exporter_test.cc @@ -3,13 +3,13 @@ #ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/exporters/elasticsearch/es_log_exporter.h" +# include "opentelemetry/exporters/elasticsearch/es_log_record_exporter.h" # include "opentelemetry/ext/http/server/http_server.h" # include "opentelemetry/logs/provider.h" # include "opentelemetry/sdk/logs/exporter.h" # include "opentelemetry/sdk/logs/log_record.h" # include "opentelemetry/sdk/logs/logger_provider.h" -# include "opentelemetry/sdk/logs/simple_log_processor.h" +# include "opentelemetry/sdk/logs/simple_log_record_processor.h" # include # include @@ -33,7 +33,7 @@ TEST(ElasticsearchLogsExporterTests, InvalidEndpoint) // Create an elasticsearch exporter auto exporter = - std::unique_ptr(new logs_exporter::ElasticsearchLogExporter(options)); + std::unique_ptr(new logs_exporter::ElasticsearchLogExporter(options)); // Create a log record and send to the exporter auto record = exporter->MakeRecordable(); @@ -48,7 +48,7 @@ TEST(ElasticsearchLogsExporterTests, Shutdown) { // Create an elasticsearch exporter and immediately shut it down auto exporter = - std::unique_ptr(new logs_exporter::ElasticsearchLogExporter); + std::unique_ptr(new logs_exporter::ElasticsearchLogExporter); bool shutdownResult = exporter->Shutdown(); ASSERT_TRUE(shutdownResult); @@ -65,7 +65,7 @@ TEST(ElasticsearchLogsExporterTests, RecordableCreation) { // Create an elasticsearch exporter auto exporter = - std::unique_ptr(new logs_exporter::ElasticsearchLogExporter); + std::unique_ptr(new logs_exporter::ElasticsearchLogExporter); // Create a recordable auto record = exporter->MakeRecordable(); diff --git a/exporters/ostream/BUILD b/exporters/ostream/BUILD index 6c0e03971e..5a11ea07b1 100644 --- a/exporters/ostream/BUILD +++ b/exporters/ostream/BUILD @@ -1,13 +1,13 @@ package(default_visibility = ["//visibility:public"]) cc_library( - name = "ostream_log_exporter", + name = "ostream_log_record_exporter", srcs = [ - "src/log_exporter.cc", + "src/log_record_exporter.cc", ], hdrs = [ "include/opentelemetry/exporters/ostream/common_utils.h", - "include/opentelemetry/exporters/ostream/log_exporter.h", + "include/opentelemetry/exporters/ostream/log_record_exporter.h", ], strip_include_prefix = "include", tags = ["ostream"], @@ -24,7 +24,7 @@ cc_test( "test", ], deps = [ - ":ostream_log_exporter", + ":ostream_log_record_exporter", "@com_google_googletest//:gtest_main", ], ) diff --git a/exporters/ostream/CMakeLists.txt b/exporters/ostream/CMakeLists.txt index 760134e394..d7b791cc73 100644 --- a/exporters/ostream/CMakeLists.txt +++ b/exporters/ostream/CMakeLists.txt @@ -96,9 +96,9 @@ else() endif() if(WITH_LOGS_PREVIEW) - add_library(opentelemetry_exporter_ostream_logs src/log_exporter.cc) + add_library(opentelemetry_exporter_ostream_logs src/log_record_exporter.cc) set_target_properties(opentelemetry_exporter_ostream_logs - PROPERTIES EXPORT_NAME ostream_log_exporter) + PROPERTIES EXPORT_NAME ostream_log_record_exporter) target_include_directories( opentelemetry_exporter_ostream_logs PUBLIC "$") @@ -113,7 +113,7 @@ if(WITH_LOGS_PREVIEW) install( DIRECTORY include/opentelemetry/exporters/ostream DESTINATION include/opentelemetry/exporters - PATTERN "log_exporter.h") + PATTERN "log_record_exporter.h") if(BUILD_TESTING) add_executable(ostream_log_test test/ostream_log_test.cc) target_link_libraries(ostream_log_test ${GTEST_BOTH_LIBRARIES} diff --git a/exporters/ostream/include/opentelemetry/exporters/ostream/log_exporter.h b/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h similarity index 98% rename from exporters/ostream/include/opentelemetry/exporters/ostream/log_exporter.h rename to exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h index 2f6acbb486..e25559a095 100644 --- a/exporters/ostream/include/opentelemetry/exporters/ostream/log_exporter.h +++ b/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h @@ -21,7 +21,7 @@ namespace logs /** * The OStreamLogExporter exports logs through an ostream (default set to std::cout) */ -class OStreamLogExporter final : public opentelemetry::sdk::logs::LogExporter +class OStreamLogExporter final : public opentelemetry::sdk::logs::LogRecordExporter { public: /** diff --git a/exporters/ostream/src/log_exporter.cc b/exporters/ostream/src/log_record_exporter.cc similarity index 98% rename from exporters/ostream/src/log_exporter.cc rename to exporters/ostream/src/log_record_exporter.cc index ecbccf8c6e..8a9562a475 100644 --- a/exporters/ostream/src/log_exporter.cc +++ b/exporters/ostream/src/log_record_exporter.cc @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/exporters/ostream/log_exporter.h" +# include "opentelemetry/exporters/ostream/log_record_exporter.h" # include # include "opentelemetry/exporters/ostream/common_utils.h" # include "opentelemetry/sdk_config.h" diff --git a/exporters/ostream/test/ostream_log_test.cc b/exporters/ostream/test/ostream_log_test.cc index 91d8fbf245..77a67c1265 100644 --- a/exporters/ostream/test/ostream_log_test.cc +++ b/exporters/ostream/test/ostream_log_test.cc @@ -4,11 +4,11 @@ #ifdef ENABLE_LOGS_PREVIEW # include -# include "opentelemetry/exporters/ostream/log_exporter.h" +# include "opentelemetry/exporters/ostream/log_record_exporter.h" # include "opentelemetry/logs/provider.h" # include "opentelemetry/nostd/span.h" # include "opentelemetry/sdk/logs/logger_provider.h" -# include "opentelemetry/sdk/logs/simple_log_processor.h" +# include "opentelemetry/sdk/logs/simple_log_record_processor.h" # include # include @@ -28,7 +28,7 @@ namespace logs // Test that when OStream Log exporter is shutdown, no logs should be sent to stream TEST(OStreamLogExporter, Shutdown) { - auto exporter = std::unique_ptr(new exporterlogs::OStreamLogExporter); + auto exporter = std::unique_ptr(new exporterlogs::OStreamLogExporter); // Save cout's original buffer here std::streambuf *original = std::cout.rdbuf(); @@ -58,7 +58,7 @@ TEST(OStreamLogExporter, Shutdown) TEST(OstreamLogExporter, DefaultLogRecordToCout) { auto exporter = - std::unique_ptr(new exporterlogs::OStreamLogExporter(std::cout)); + std::unique_ptr(new exporterlogs::OStreamLogExporter(std::cout)); // Save cout's original buffer here std::streambuf *original = std::cout.rdbuf(); @@ -102,7 +102,7 @@ TEST(OStreamLogExporter, SimpleLogToCout) { // Initialize an Ostream exporter to std::cout auto exporter = - std::unique_ptr(new exporterlogs::OStreamLogExporter(std::cout)); + std::unique_ptr(new exporterlogs::OStreamLogExporter(std::cout)); // Save original stream buffer, then redirect cout to our new stream buffer std::streambuf *original = std::cout.rdbuf(); @@ -156,7 +156,7 @@ TEST(OStreamLogExporter, LogWithStringAttributesToCerr) { // Initialize an Ostream exporter to cerr auto exporter = - std::unique_ptr(new exporterlogs::OStreamLogExporter(std::cerr)); + std::unique_ptr(new exporterlogs::OStreamLogExporter(std::cerr)); // Save original stream buffer, then redirect cout to our new stream buffer std::streambuf *original = std::cerr.rdbuf(); @@ -213,7 +213,7 @@ TEST(OStreamLogExporter, LogWithVariantTypesToClog) // Initialize an Ostream exporter to cerr auto exporter = - std::unique_ptr(new exporterlogs::OStreamLogExporter(std::clog)); + std::unique_ptr(new exporterlogs::OStreamLogExporter(std::clog)); // Save original stream buffer, then redirect cout to our new stream buffer std::streambuf *original = std::clog.rdbuf(); @@ -273,10 +273,10 @@ TEST(OStreamLogExporter, LogWithVariantTypesToClog) TEST(OStreamLogExporter, IntegrationTest) { // Initialize a logger - auto exporter = std::unique_ptr(new exporterlogs::OStreamLogExporter); + auto exporter = std::unique_ptr(new exporterlogs::OStreamLogExporter); auto sdkProvider = std::shared_ptr(new sdklogs::LoggerProvider()); - sdkProvider->AddProcessor( - std::unique_ptr(new sdklogs::SimpleLogProcessor(std::move(exporter)))); + sdkProvider->AddProcessor(std::unique_ptr( + new sdklogs::SimpleLogProcessor(std::move(exporter)))); auto apiProvider = nostd::shared_ptr(sdkProvider); auto provider = nostd::shared_ptr(apiProvider); logs_api::Provider::SetLoggerProvider(provider); diff --git a/exporters/otlp/BUILD b/exporters/otlp/BUILD index b029cbe65b..04f922f1d8 100644 --- a/exporters/otlp/BUILD +++ b/exporters/otlp/BUILD @@ -224,16 +224,16 @@ cc_library( ) cc_library( - name = "otlp_http_log_exporter", + name = "otlp_http_log_record_exporter", srcs = [ - "src/otlp_http_log_exporter.cc", - "src/otlp_http_log_exporter_factory.cc", + "src/otlp_http_log_record_exporter.cc", + "src/otlp_http_log_record_exporter_factory.cc", ], hdrs = [ "include/opentelemetry/exporters/otlp/otlp_environment.h", - "include/opentelemetry/exporters/otlp/otlp_http_log_exporter.h", - "include/opentelemetry/exporters/otlp/otlp_http_log_exporter_factory.h", - "include/opentelemetry/exporters/otlp/otlp_http_log_exporter_options.h", + "include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h", + "include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h", + "include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h", "include/opentelemetry/exporters/otlp/protobuf_include_prefix.h", "include/opentelemetry/exporters/otlp/protobuf_include_suffix.h", ], @@ -251,16 +251,16 @@ cc_library( ) cc_library( - name = "otlp_grpc_log_exporter", + name = "otlp_grpc_log_record_exporter", srcs = [ - "src/otlp_grpc_log_exporter.cc", - "src/otlp_grpc_log_exporter_factory.cc", + "src/otlp_grpc_log_record_exporter.cc", + "src/otlp_grpc_log_record_exporter_factory.cc", ], hdrs = [ "include/opentelemetry/exporters/otlp/otlp_environment.h", "include/opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h", - "include/opentelemetry/exporters/otlp/otlp_grpc_log_exporter.h", - "include/opentelemetry/exporters/otlp/otlp_grpc_log_exporter_factory.h", + "include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h", + "include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h", "include/opentelemetry/exporters/otlp/protobuf_include_prefix.h", "include/opentelemetry/exporters/otlp/protobuf_include_suffix.h", ], @@ -373,15 +373,15 @@ cc_test( ) cc_test( - name = "otlp_http_log_exporter_test", - srcs = ["test/otlp_http_log_exporter_test.cc"], + name = "otlp_http_log_record_exporter_test", + srcs = ["test/otlp_http_log_record_exporter_test.cc"], tags = [ "otlp", "otlp_http_log", "test", ], deps = [ - ":otlp_http_log_exporter", + ":otlp_http_log_record_exporter", "//api", "//ext/src/http/client/nosend:http_client_nosend", "@com_google_googletest//:gtest_main", @@ -389,15 +389,15 @@ cc_test( ) cc_test( - name = "otlp_http_log_exporter_factory_test", - srcs = ["test/otlp_http_log_exporter_factory_test.cc"], + name = "otlp_http_log_record_exporter_factory_test", + srcs = ["test/otlp_http_log_record_exporter_factory_test.cc"], tags = [ "otlp", "otlp_http_log", "test", ], deps = [ - ":otlp_http_log_exporter", + ":otlp_http_log_record_exporter", "//api", "//ext/src/http/client/nosend:http_client_nosend", "@com_google_googletest//:gtest_main", @@ -405,15 +405,15 @@ cc_test( ) cc_test( - name = "otlp_grpc_log_exporter_test", - srcs = ["test/otlp_grpc_log_exporter_test.cc"], + name = "otlp_grpc_log_record_exporter_test", + srcs = ["test/otlp_grpc_log_record_exporter_test.cc"], tags = [ "otlp", "otlp_grpc_log", "test", ], deps = [ - ":otlp_grpc_log_exporter", + ":otlp_grpc_log_record_exporter", "//api", "//sdk/src/logs", "@com_google_googletest//:gtest_main", @@ -421,15 +421,15 @@ cc_test( ) cc_test( - name = "otlp_grpc_log_exporter_factory_test", - srcs = ["test/otlp_grpc_log_exporter_factory_test.cc"], + name = "otlp_grpc_log_record_exporter_factory_test", + srcs = ["test/otlp_grpc_log_record_exporter_factory_test.cc"], tags = [ "otlp", "otlp_grpc_log", "test", ], deps = [ - ":otlp_grpc_log_exporter", + ":otlp_grpc_log_record_exporter", "//api", "//sdk/src/logs", "@com_google_googletest//:gtest_main", diff --git a/exporters/otlp/CMakeLists.txt b/exporters/otlp/CMakeLists.txt index 7c158a09ac..8fba905293 100644 --- a/exporters/otlp/CMakeLists.txt +++ b/exporters/otlp/CMakeLists.txt @@ -64,11 +64,12 @@ if(WITH_OTLP_GRPC) list(APPEND OPENTELEMETRY_OTLP_TARGETS opentelemetry_exporter_otlp_grpc) add_library( - opentelemetry_exporter_otlp_grpc_log src/otlp_grpc_log_exporter.cc - src/otlp_grpc_log_exporter_factory.cc) + opentelemetry_exporter_otlp_grpc_log + src/otlp_grpc_log_record_exporter.cc + src/otlp_grpc_log_record_exporter_factory.cc) set_target_properties(opentelemetry_exporter_otlp_grpc_log - PROPERTIES EXPORT_NAME otlp_grpc_log_exporter) + PROPERTIES EXPORT_NAME otlp_grpc_log_record_exporter) target_link_libraries( opentelemetry_exporter_otlp_grpc_log @@ -132,10 +133,11 @@ if(WITH_OTLP_HTTP) if(WITH_LOGS_PREVIEW) add_library( opentelemetry_exporter_otlp_http_log - src/otlp_http_log_exporter.cc src/otlp_http_log_exporter_factory.cc) + src/otlp_http_log_record_exporter.cc + src/otlp_http_log_record_exporter_factory.cc) set_target_properties(opentelemetry_exporter_otlp_http_log - PROPERTIES EXPORT_NAME otlp_http_log_exporter) + PROPERTIES EXPORT_NAME otlp_http_log_record_exporter) target_link_libraries( opentelemetry_exporter_otlp_http_log @@ -248,27 +250,27 @@ if(BUILD_TESTING) TEST_LIST otlp_grpc_exporter_factory_test) if(WITH_LOGS_PREVIEW) - add_executable(otlp_grpc_log_exporter_test - test/otlp_grpc_log_exporter_test.cc) + add_executable(otlp_grpc_log_record_exporter_test + test/otlp_grpc_log_record_exporter_test.cc) target_link_libraries( - otlp_grpc_log_exporter_test ${GTEST_BOTH_LIBRARIES} + otlp_grpc_log_record_exporter_test ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${GMOCK_LIB} opentelemetry_exporter_otlp_grpc_log opentelemetry_logs) gtest_add_tests( - TARGET otlp_grpc_log_exporter_test + TARGET otlp_grpc_log_record_exporter_test TEST_PREFIX exporter.otlp. - TEST_LIST otlp_grpc_log_exporter_test) + TEST_LIST otlp_grpc_log_record_exporter_test) - add_executable(otlp_grpc_log_exporter_factory_test - test/otlp_grpc_log_exporter_factory_test.cc) + add_executable(otlp_grpc_log_record_exporter_factory_test + test/otlp_grpc_log_record_exporter_factory_test.cc) target_link_libraries( - otlp_grpc_log_exporter_factory_test ${GTEST_BOTH_LIBRARIES} + otlp_grpc_log_record_exporter_factory_test ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${GMOCK_LIB} opentelemetry_exporter_otlp_grpc_log opentelemetry_logs) gtest_add_tests( - TARGET otlp_grpc_log_exporter_factory_test + TARGET otlp_grpc_log_record_exporter_factory_test TEST_PREFIX exporter.otlp. - TEST_LIST otlp_grpc_log_exporter_factory_test) + TEST_LIST otlp_grpc_log_record_exporter_factory_test) endif() if(NOT WITH_METRICS_PREVIEW) @@ -306,10 +308,10 @@ if(BUILD_TESTING) TEST_LIST otlp_http_exporter_factory_test) if(WITH_LOGS_PREVIEW) - add_executable(otlp_http_log_exporter_test - test/otlp_http_log_exporter_test.cc) + add_executable(otlp_http_log_record_exporter_test + test/otlp_http_log_record_exporter_test.cc) target_link_libraries( - otlp_http_log_exporter_test + otlp_http_log_record_exporter_test ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${GMOCK_LIB} @@ -317,20 +319,20 @@ if(BUILD_TESTING) opentelemetry_logs http_client_nosend) gtest_add_tests( - TARGET otlp_http_log_exporter_test + TARGET otlp_http_log_record_exporter_test TEST_PREFIX exporter.otlp. - TEST_LIST otlp_http_log_exporter_test) + TEST_LIST otlp_http_log_record_exporter_test) - add_executable(otlp_http_log_exporter_factory_test - test/otlp_http_log_exporter_factory_test.cc) + add_executable(otlp_http_log_record_exporter_factory_test + test/otlp_http_log_record_exporter_factory_test.cc) target_link_libraries( - otlp_http_log_exporter_factory_test ${GTEST_BOTH_LIBRARIES} + otlp_http_log_record_exporter_factory_test ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${GMOCK_LIB} opentelemetry_exporter_otlp_http_log opentelemetry_logs) gtest_add_tests( - TARGET otlp_http_log_exporter_factory_test + TARGET otlp_http_log_record_exporter_factory_test TEST_PREFIX exporter.otlp. - TEST_LIST otlp_http_log_exporter_factory_test) + TEST_LIST otlp_http_log_record_exporter_factory_test) endif() if(NOT WITH_METRICS_PREVIEW) diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_exporter.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h similarity index 99% rename from exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_exporter.h rename to exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h index a8aeda85b8..7adcfa9976 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_exporter.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h @@ -26,7 +26,7 @@ namespace otlp /** * The OTLP exporter exports log data in OpenTelemetry Protocol (OTLP) format in gRPC. */ -class OtlpGrpcLogExporter : public opentelemetry::sdk::logs::LogExporter +class OtlpGrpcLogExporter : public opentelemetry::sdk::logs::LogRecordExporter { public: /** diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_exporter_factory.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h similarity index 80% rename from exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_exporter_factory.h rename to exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h index dfe3dfd6a0..eac0877c2a 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_exporter_factory.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h @@ -23,12 +23,12 @@ class OtlpGrpcLogExporterFactory /** * Create a OtlpGrpcLogExporter. */ - static std::unique_ptr Create(); + static std::unique_ptr Create(); /** * Create a OtlpGrpcLogExporter. */ - static std::unique_ptr Create( + static std::unique_ptr Create( const OtlpGrpcExporterOptions &options); }; diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_exporter.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h similarity index 95% rename from exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_exporter.h rename to exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h index c139b9ee6c..e35cde7671 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_exporter.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h @@ -9,7 +9,7 @@ # include "opentelemetry/exporters/otlp/otlp_http_client.h" # include "opentelemetry/exporters/otlp/otlp_environment.h" -# include "opentelemetry/exporters/otlp/otlp_http_log_exporter_options.h" +# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" # include # include @@ -25,7 +25,7 @@ namespace otlp /** * The OTLP exporter exports log data in OpenTelemetry Protocol (OTLP) format. */ -class OtlpHttpLogExporter final : public opentelemetry::sdk::logs::LogExporter +class OtlpHttpLogExporter final : public opentelemetry::sdk::logs::LogRecordExporter { public: /** diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_exporter_factory.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h similarity index 70% rename from exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_exporter_factory.h rename to exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h index b2f509f683..1db6c776f2 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_exporter_factory.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h @@ -4,7 +4,7 @@ #pragma once #ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/exporters/otlp/otlp_http_log_exporter_options.h" +# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" # include "opentelemetry/sdk/logs/exporter.h" # include @@ -24,12 +24,12 @@ class OtlpHttpLogExporterFactory /** * Create a OtlpHttpLogExporter. */ - static std::unique_ptr Create(); + static std::unique_ptr Create(); /** * Create a OtlpHttpLogExporter. */ - static std::unique_ptr Create( + static std::unique_ptr Create( const OtlpHttpLogExporterOptions &options); }; diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_exporter_options.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h similarity index 100% rename from exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_exporter_options.h rename to exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h diff --git a/exporters/otlp/src/otlp_grpc_log_exporter.cc b/exporters/otlp/src/otlp_grpc_log_record_exporter.cc similarity index 97% rename from exporters/otlp/src/otlp_grpc_log_exporter.cc rename to exporters/otlp/src/otlp_grpc_log_record_exporter.cc index 1f3bcfc35a..d8d0c44e6c 100644 --- a/exporters/otlp/src/otlp_grpc_log_exporter.cc +++ b/exporters/otlp/src/otlp_grpc_log_record_exporter.cc @@ -7,7 +7,7 @@ # include # include "opentelemetry/exporters/otlp/otlp_grpc_client.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_log_exporter.h" +# include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h" # include "opentelemetry/exporters/otlp/otlp_log_recordable.h" # include "opentelemetry/exporters/otlp/otlp_recordable_utils.h" diff --git a/exporters/otlp/src/otlp_grpc_log_exporter_factory.cc b/exporters/otlp/src/otlp_grpc_log_record_exporter_factory.cc similarity index 51% rename from exporters/otlp/src/otlp_grpc_log_exporter_factory.cc rename to exporters/otlp/src/otlp_grpc_log_record_exporter_factory.cc index 9e90070844..bc015cfbee 100644 --- a/exporters/otlp/src/otlp_grpc_log_exporter_factory.cc +++ b/exporters/otlp/src/otlp_grpc_log_record_exporter_factory.cc @@ -4,10 +4,10 @@ #ifdef ENABLE_LOGS_PREVIEW // MUST be first (absl) -# include "opentelemetry/exporters/otlp/otlp_grpc_log_exporter.h" +# include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h" # include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_log_exporter_factory.h" +# include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -15,16 +15,17 @@ namespace exporter namespace otlp { -std::unique_ptr OtlpGrpcLogExporterFactory::Create() +std::unique_ptr OtlpGrpcLogExporterFactory::Create() { OtlpGrpcExporterOptions options; return Create(options); } -std::unique_ptr OtlpGrpcLogExporterFactory::Create( +std::unique_ptr OtlpGrpcLogExporterFactory::Create( const OtlpGrpcExporterOptions &options) { - std::unique_ptr exporter(new OtlpGrpcLogExporter(options)); + std::unique_ptr exporter( + new OtlpGrpcLogExporter(options)); return exporter; } diff --git a/exporters/otlp/src/otlp_http_log_exporter_factory.cc b/exporters/otlp/src/otlp_http_log_exporter_factory.cc deleted file mode 100644 index 29e173454d..0000000000 --- a/exporters/otlp/src/otlp_http_log_exporter_factory.cc +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/exporters/otlp/otlp_http_log_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_http_log_exporter.h" -# include "opentelemetry/exporters/otlp/otlp_http_log_exporter_options.h" - -OPENTELEMETRY_BEGIN_NAMESPACE -namespace exporter -{ -namespace otlp -{ - -std::unique_ptr OtlpHttpLogExporterFactory::Create() -{ - OtlpHttpLogExporterOptions options; - return Create(options); -} - -std::unique_ptr OtlpHttpLogExporterFactory::Create( - const OtlpHttpLogExporterOptions &options) -{ - std::unique_ptr exporter(new OtlpHttpLogExporter(options)); - return exporter; -} - -} // namespace otlp -} // namespace exporter -OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/exporters/otlp/src/otlp_http_log_exporter.cc b/exporters/otlp/src/otlp_http_log_record_exporter.cc similarity index 98% rename from exporters/otlp/src/otlp_http_log_exporter.cc rename to exporters/otlp/src/otlp_http_log_record_exporter.cc index 24a5b3d0fd..46aa7ec346 100644 --- a/exporters/otlp/src/otlp_http_log_exporter.cc +++ b/exporters/otlp/src/otlp_http_log_record_exporter.cc @@ -3,7 +3,7 @@ #ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/exporters/otlp/otlp_http_log_exporter.h" +# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h" # include "opentelemetry/exporters/otlp/otlp_log_recordable.h" # include "opentelemetry/exporters/otlp/otlp_recordable_utils.h" diff --git a/exporters/otlp/src/otlp_http_log_record_exporter_factory.cc b/exporters/otlp/src/otlp_http_log_record_exporter_factory.cc new file mode 100644 index 0000000000..4e9c27a249 --- /dev/null +++ b/exporters/otlp/src/otlp_http_log_record_exporter_factory.cc @@ -0,0 +1,34 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#ifdef ENABLE_LOGS_PREVIEW + +# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h" +# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h" +# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace exporter +{ +namespace otlp +{ + +std::unique_ptr OtlpHttpLogExporterFactory::Create() +{ + OtlpHttpLogExporterOptions options; + return Create(options); +} + +std::unique_ptr OtlpHttpLogExporterFactory::Create( + const OtlpHttpLogExporterOptions &options) +{ + std::unique_ptr exporter( + new OtlpHttpLogExporter(options)); + return exporter; +} + +} // namespace otlp +} // namespace exporter +OPENTELEMETRY_END_NAMESPACE + +#endif diff --git a/exporters/otlp/test/otlp_grpc_log_exporter_factory_test.cc b/exporters/otlp/test/otlp_grpc_log_record_exporter_factory_test.cc similarity index 83% rename from exporters/otlp/test/otlp_grpc_log_exporter_factory_test.cc rename to exporters/otlp/test/otlp_grpc_log_record_exporter_factory_test.cc index 98f42721f1..bf50d8c99c 100644 --- a/exporters/otlp/test/otlp_grpc_log_exporter_factory_test.cc +++ b/exporters/otlp/test/otlp_grpc_log_record_exporter_factory_test.cc @@ -6,7 +6,7 @@ # include # include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_log_exporter_factory.h" +# include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h" /* Make sure OtlpGrpcLogExporterFactory does not require, @@ -27,7 +27,7 @@ TEST(OtlpGrpcLogExporterFactoryTest, BuildTest) OtlpGrpcExporterOptions opts; opts.endpoint = "localhost:45454"; - std::unique_ptr exporter = + std::unique_ptr exporter = OtlpGrpcLogExporterFactory::Create(opts); EXPECT_TRUE(exporter != nullptr); diff --git a/exporters/otlp/test/otlp_grpc_log_exporter_test.cc b/exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc similarity index 95% rename from exporters/otlp/test/otlp_grpc_log_exporter_test.cc rename to exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc index e7574fb5ba..b6c796b5b6 100644 --- a/exporters/otlp/test/otlp_grpc_log_exporter_test.cc +++ b/exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc @@ -5,7 +5,7 @@ # include -# include "opentelemetry/exporters/otlp/otlp_grpc_log_exporter.h" +# include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h" # include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" @@ -14,7 +14,7 @@ # include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" # include "opentelemetry/logs/provider.h" -# include "opentelemetry/sdk/logs/batch_log_processor.h" +# include "opentelemetry/sdk/logs/batch_log_record_processor.h" # include "opentelemetry/sdk/logs/exporter.h" # include "opentelemetry/sdk/logs/log_record.h" # include "opentelemetry/sdk/logs/logger_provider.h" @@ -39,10 +39,10 @@ namespace otlp class OtlpGrpcLogExporterTestPeer : public ::testing::Test { public: - std::unique_ptr GetExporter( + std::unique_ptr GetExporter( std::unique_ptr &stub_interface) { - return std::unique_ptr( + return std::unique_ptr( new OtlpGrpcLogExporter(std::move(stub_interface))); } @@ -121,7 +121,7 @@ TEST_F(OtlpGrpcLogExporterTestPeer, ExportIntegrationTest) opentelemetry::nostd::string_view attribute_storage_string_value[] = {"vector", "string"}; auto provider = nostd::shared_ptr(new sdk::logs::LoggerProvider()); - provider->AddProcessor(std::unique_ptr( + provider->AddProcessor(std::unique_ptr( new sdk::logs::BatchLogProcessor(std::move(exporter), 5, std::chrono::milliseconds(256), 1))); EXPECT_CALL(*mock_stub, Export(_, _, _)) diff --git a/exporters/otlp/test/otlp_http_log_exporter_factory_test.cc b/exporters/otlp/test/otlp_http_log_record_exporter_factory_test.cc similarity index 79% rename from exporters/otlp/test/otlp_http_log_exporter_factory_test.cc rename to exporters/otlp/test/otlp_http_log_record_exporter_factory_test.cc index 3d54a3fa9b..af4e1874b1 100644 --- a/exporters/otlp/test/otlp_http_log_exporter_factory_test.cc +++ b/exporters/otlp/test/otlp_http_log_record_exporter_factory_test.cc @@ -5,8 +5,8 @@ # include -# include "opentelemetry/exporters/otlp/otlp_http_log_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_http_log_exporter_options.h" +# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h" +# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" /* Make sure OtlpHttpExporterFactory does not require, @@ -35,7 +35,7 @@ TEST(OtlpHttpLogExporterFactoryTest, BuildTest) OtlpHttpLogExporterOptions opts; opts.url = "localhost:45454"; - std::unique_ptr exporter = + std::unique_ptr exporter = OtlpHttpLogExporterFactory::Create(opts); EXPECT_TRUE(exporter != nullptr); diff --git a/exporters/otlp/test/otlp_http_log_exporter_test.cc b/exporters/otlp/test/otlp_http_log_record_exporter_test.cc similarity index 97% rename from exporters/otlp/test/otlp_http_log_exporter_test.cc rename to exporters/otlp/test/otlp_http_log_record_exporter_test.cc index c79acf0069..9c9d663f50 100644 --- a/exporters/otlp/test/otlp_http_log_exporter_test.cc +++ b/exporters/otlp/test/otlp_http_log_record_exporter_test.cc @@ -7,7 +7,7 @@ # include # include -# include "opentelemetry/exporters/otlp/otlp_http_log_exporter.h" +# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h" # include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" @@ -20,7 +20,7 @@ # include "opentelemetry/ext/http/client/nosend/http_client_nosend.h" # include "opentelemetry/ext/http/server/http_server.h" # include "opentelemetry/logs/provider.h" -# include "opentelemetry/sdk/logs/batch_log_processor.h" +# include "opentelemetry/sdk/logs/batch_log_record_processor.h" # include "opentelemetry/sdk/logs/exporter.h" # include "opentelemetry/sdk/logs/log_record.h" # include "opentelemetry/sdk/logs/logger_provider.h" @@ -74,9 +74,11 @@ namespace http_client = opentelemetry::ext::http::client; class OtlpHttpLogExporterTestPeer : public ::testing::Test { public: - std::unique_ptr GetExporter(std::unique_ptr http_client) + std::unique_ptr GetExporter( + std::unique_ptr http_client) { - return std::unique_ptr(new OtlpHttpLogExporter(std::move(http_client))); + return std::unique_ptr( + new OtlpHttpLogExporter(std::move(http_client))); } // Get the options associated with the given exporter. @@ -111,7 +113,7 @@ class OtlpHttpLogExporterTestPeer : public ::testing::Test auto provider = nostd::shared_ptr(new sdk::logs::LoggerProvider()); provider->AddProcessor( - std::unique_ptr(new sdk::logs::BatchLogProcessor( + std::unique_ptr(new sdk::logs::BatchLogProcessor( std::move(exporter), 5, std::chrono::milliseconds(256), 5))); std::string report_trace_id; @@ -208,7 +210,7 @@ class OtlpHttpLogExporterTestPeer : public ::testing::Test options.schedule_delay_millis = std::chrono::milliseconds(256); options.max_export_batch_size = 5; - provider->AddProcessor(std::unique_ptr( + provider->AddProcessor(std::unique_ptr( new sdk::logs::BatchLogProcessor(std::move(exporter), options))); std::string report_trace_id; @@ -309,7 +311,7 @@ class OtlpHttpLogExporterTestPeer : public ::testing::Test processor_options.max_export_batch_size = 5; processor_options.max_queue_size = 5; processor_options.schedule_delay_millis = std::chrono::milliseconds(256); - provider->AddProcessor(std::unique_ptr( + provider->AddProcessor(std::unique_ptr( new sdk::logs::BatchLogProcessor(std::move(exporter), processor_options))); std::string report_trace_id; @@ -404,7 +406,7 @@ class OtlpHttpLogExporterTestPeer : public ::testing::Test processor_options.max_export_batch_size = 5; processor_options.max_queue_size = 5; processor_options.schedule_delay_millis = std::chrono::milliseconds(256); - provider->AddProcessor(std::unique_ptr( + provider->AddProcessor(std::unique_ptr( new sdk::logs::BatchLogProcessor(std::move(exporter), processor_options))); std::string report_trace_id; @@ -484,7 +486,8 @@ class OtlpHttpLogExporterTestPeer : public ::testing::Test TEST(OtlpHttpLogExporterTest, Shutdown) { - auto exporter = std::unique_ptr(new OtlpHttpLogExporter()); + auto exporter = + std::unique_ptr(new OtlpHttpLogExporter()); ASSERT_TRUE(exporter->Shutdown()); nostd::span> logs = {}; diff --git a/sdk/include/opentelemetry/sdk/logs/batch_log_processor.h b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h similarity index 90% rename from sdk/include/opentelemetry/sdk/logs/batch_log_processor.h rename to sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h index efeb6dc675..122c9534e7 100644 --- a/sdk/include/opentelemetry/sdk/logs/batch_log_processor.h +++ b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h @@ -5,7 +5,7 @@ #ifdef ENABLE_LOGS_PREVIEW # include "opentelemetry/sdk/common/circular_buffer.h" -# include "opentelemetry/sdk/logs/batch_log_processor_options.h" +# include "opentelemetry/sdk/logs/batch_log_record_processor_options.h" # include "opentelemetry/sdk/logs/exporter.h" # include "opentelemetry/sdk/logs/processor.h" @@ -23,10 +23,10 @@ namespace logs { /** - * This is an implementation of the LogProcessor which creates batches of finished logs and passes - * the export-friendly log data representations to the configured LogExporter. + * This is an implementation of the LogRecordProcessor which creates batches of finished logs and + * passes the export-friendly log data representations to the configured LogRecordExporter. */ -class BatchLogProcessor : public LogProcessor +class BatchLogProcessor : public LogRecordProcessor { public: /** @@ -41,7 +41,7 @@ class BatchLogProcessor : public LogProcessor * equal to max_queue_size */ explicit BatchLogProcessor( - std::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,7 +53,7 @@ class BatchLogProcessor : public LogProcessor * @param exporter - The backend exporter to pass the logs to * @param options - The batch SpanProcessor options. */ - explicit BatchLogProcessor(std::unique_ptr &&exporter, + explicit BatchLogProcessor(std::unique_ptr &&exporter, const BatchLogProcessorOptions &options); /** Makes a new recordable **/ @@ -134,7 +134,7 @@ class BatchLogProcessor : public LogProcessor std::chrono::time_point &start_time); /* The configured backend log exporter */ - std::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_processor_factory.h b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_factory.h similarity index 66% rename from sdk/include/opentelemetry/sdk/logs/batch_log_processor_factory.h rename to sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_factory.h index 6ccb8e43c0..d66e5471c9 100644 --- a/sdk/include/opentelemetry/sdk/logs/batch_log_processor_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_factory.h @@ -5,7 +5,7 @@ #ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/sdk/logs/batch_log_processor_options.h" +# include "opentelemetry/sdk/logs/batch_log_record_processor_options.h" # include "opentelemetry/sdk/logs/exporter.h" # include "opentelemetry/sdk/logs/processor.h" @@ -25,8 +25,8 @@ class BatchLogProcessorFactory /** * Create a BatchLogProcessor. */ - std::unique_ptr Create(std::unique_ptr &&exporter, - const BatchLogProcessorOptions &options); + std::unique_ptr Create(std::unique_ptr &&exporter, + const BatchLogProcessorOptions &options); }; } // namespace logs diff --git a/sdk/include/opentelemetry/sdk/logs/batch_log_processor_options.h b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_options.h similarity index 100% rename from sdk/include/opentelemetry/sdk/logs/batch_log_processor_options.h rename to sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_options.h diff --git a/sdk/include/opentelemetry/sdk/logs/exporter.h b/sdk/include/opentelemetry/sdk/logs/exporter.h index 85c58e9f12..02865dc204 100644 --- a/sdk/include/opentelemetry/sdk/logs/exporter.h +++ b/sdk/include/opentelemetry/sdk/logs/exporter.h @@ -17,16 +17,16 @@ namespace sdk namespace logs { /** - * LogExporter defines the interface that log exporters must implement. + * LogRecordExporter defines the interface that log exporters must implement. */ -class LogExporter +class LogRecordExporter { public: - virtual ~LogExporter() = default; + virtual ~LogRecordExporter() = default; /** * Create a log recordable. This object will be used to record log data and - * will subsequently be passed to LogExporter::Export. Vendors can implement + * will subsequently be passed to LogRecordExporter::Export. Vendors can implement * custom recordables or use the default LogRecord recordable provided by the * SDK. * @return a newly initialized Recordable object diff --git a/sdk/include/opentelemetry/sdk/logs/logger_context.h b/sdk/include/opentelemetry/sdk/logs/logger_context.h index 01c2f7dd89..da41c122b7 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger_context.h +++ b/sdk/include/opentelemetry/sdk/logs/logger_context.h @@ -30,7 +30,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 +42,7 @@ class LoggerContext * * Note: This method is not thread safe. */ - void AddProcessor(std::unique_ptr processor) noexcept; + void AddProcessor(std::unique_ptr processor) noexcept; /** * Obtain the configured (composite) processor. @@ -50,7 +50,7 @@ class LoggerContext * Note: When more than one processor is active, this will * return an "aggregate" processor */ - LogProcessor &GetProcessor() const noexcept; + LogRecordProcessor &GetProcessor() const noexcept; /** * Obtain the resource associated with this tracer context. @@ -72,7 +72,7 @@ class LoggerContext private: // order of declaration is important here - resource object should be destroyed after processor. opentelemetry::sdk::resource::Resource resource_; - std::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 55a5ec87fa..28dc24d56c 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger_context_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/logger_context_factory.h @@ -26,13 +26,13 @@ class LoggerContextFactory * Create a LoggerContext. */ static std::unique_ptr Create( - std::vector> &&processors); + std::vector> &&processors); /** * Create a LoggerContext. */ static std::unique_ptr Create( - std::vector> &&processors, + 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 e91c69040e..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(std::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(std::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 eb6bee2ab1..e103fce8be 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger_provider_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/logger_provider_factory.h @@ -31,26 +31,26 @@ class LoggerProviderFactory * Create a LoggerProvider. */ static std::unique_ptr Create( - std::unique_ptr &&processor); + std::unique_ptr &&processor); /** * Create a LoggerProvider. */ static std::unique_ptr Create( - std::unique_ptr &&processor, + std::unique_ptr &&processor, const opentelemetry::sdk::resource::Resource &resource); /** * Create a LoggerProvider. */ static std::unique_ptr Create( - std::vector> &&processors); + std::vector> &&processors); /** * Create a LoggerProvider. */ static std::unique_ptr Create( - std::vector> &&processors, + std::vector> &&processors, const opentelemetry::sdk::resource::Resource &resource); /** diff --git a/sdk/include/opentelemetry/sdk/logs/multi_log_processor.h b/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h similarity index 87% rename from sdk/include/opentelemetry/sdk/logs/multi_log_processor.h rename to sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h index 6b23a2652f..5c3981a4ce 100644 --- a/sdk/include/opentelemetry/sdk/logs/multi_log_processor.h +++ b/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h @@ -25,13 +25,13 @@ namespace logs * Built-in log processors are responsible for batching and conversion of * logs to exportable representation and passing batches to exporters. */ -class MultiLogProcessor : public LogProcessor +class MultiLogProcessor : public LogRecordProcessor { public: - MultiLogProcessor(std::vector> &&processors); + MultiLogProcessor(std::vector> &&processors); ~MultiLogProcessor() override; - void AddProcessor(std::unique_ptr &&processor); + void AddProcessor(std::unique_ptr &&processor); std::unique_ptr MakeRecordable() noexcept override; @@ -60,7 +60,7 @@ class MultiLogProcessor : public LogProcessor 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_processor_factory.h b/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor_factory.h similarity index 78% rename from sdk/include/opentelemetry/sdk/logs/multi_log_processor_factory.h rename to sdk/include/opentelemetry/sdk/logs/multi_log_record_processor_factory.h index a61ae5522b..3b94f675ac 100644 --- a/sdk/include/opentelemetry/sdk/logs/multi_log_processor_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor_factory.h @@ -22,8 +22,8 @@ namespace logs class MultiLogProcessorFactory { public: - static std::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 d2d9e9952c..9b37806e2a 100644 --- a/sdk/include/opentelemetry/sdk/logs/multi_recordable.h +++ b/sdk/include/opentelemetry/sdk/logs/multi_recordable.h @@ -23,12 +23,13 @@ namespace logs class MultiRecordable final : public Recordable { public: - void AddRecordable(const LogProcessor &processor, + void AddRecordable(const LogRecordProcessor &processor, std::unique_ptr recordable) noexcept; - const std::unique_ptr &GetRecordable(const LogProcessor &processor) const noexcept; + const std::unique_ptr &GetRecordable( + const LogRecordProcessor &processor) const noexcept; - std::unique_ptr ReleaseRecordable(const LogProcessor &processor) noexcept; + std::unique_ptr ReleaseRecordable(const LogRecordProcessor &processor) noexcept; /** * Set the timestamp for this log. diff --git a/sdk/include/opentelemetry/sdk/logs/processor.h b/sdk/include/opentelemetry/sdk/logs/processor.h index 0fdc8a422f..536140f7db 100644 --- a/sdk/include/opentelemetry/sdk/logs/processor.h +++ b/sdk/include/opentelemetry/sdk/logs/processor.h @@ -17,10 +17,10 @@ namespace logs * The Log Processor is responsible for passing log records * to the configured exporter. */ -class LogProcessor +class LogRecordProcessor { public: - virtual ~LogProcessor() = default; + virtual ~LogRecordProcessor() = default; /** * Create a log recordable. This requests a new log recordable from the diff --git a/sdk/include/opentelemetry/sdk/logs/simple_log_processor.h b/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h similarity index 82% rename from sdk/include/opentelemetry/sdk/logs/simple_log_processor.h rename to sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h index f8f29542a5..5d4703d7f4 100644 --- a/sdk/include/opentelemetry/sdk/logs/simple_log_processor.h +++ b/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h @@ -19,16 +19,16 @@ namespace logs /** * The simple log processor passes all log records * in a batch of 1 to the configured - * LogExporter. + * LogRecordExporter. * - * All calls to the configured LogExporter are synchronized using a + * All calls to the configured LogRecordExporter are synchronized using a * spin-lock on an atomic_flag. */ -class SimpleLogProcessor : public LogProcessor +class SimpleLogProcessor : public LogRecordProcessor { public: - explicit SimpleLogProcessor(std::unique_ptr &&exporter); + explicit SimpleLogProcessor(std::unique_ptr &&exporter); ~SimpleLogProcessor() override = default; std::unique_ptr MakeRecordable() noexcept override; @@ -45,7 +45,7 @@ class SimpleLogProcessor : public LogProcessor private: // The configured exporter - std::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_processor_factory.h b/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor_factory.h similarity index 83% rename from sdk/include/opentelemetry/sdk/logs/simple_log_processor_factory.h rename to sdk/include/opentelemetry/sdk/logs/simple_log_record_processor_factory.h index 2576a61eb6..d808a38b98 100644 --- a/sdk/include/opentelemetry/sdk/logs/simple_log_processor_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor_factory.h @@ -23,7 +23,7 @@ class SimpleLogProcessorFactory /** * Create a SimpleLogProcessor. */ - static std::unique_ptr Create(std::unique_ptr &&exporter); + static std::unique_ptr Create(std::unique_ptr &&exporter); }; } // namespace logs diff --git a/sdk/src/logs/CMakeLists.txt b/sdk/src/logs/CMakeLists.txt index ec9a3b8c79..546e66614b 100644 --- a/sdk/src/logs/CMakeLists.txt +++ b/sdk/src/logs/CMakeLists.txt @@ -3,14 +3,14 @@ add_library( logger_provider.cc logger_provider_factory.cc logger.cc - simple_log_processor.cc - simple_log_processor_factory.cc - batch_log_processor.cc - batch_log_processor_factory.cc + simple_log_record_processor.cc + simple_log_record_processor_factory.cc + batch_log_record_processor.cc + batch_log_record_processor_factory.cc logger_context.cc logger_context_factory.cc - multi_log_processor.cc - multi_log_processor_factory.cc + multi_log_record_processor.cc + multi_log_record_processor_factory.cc multi_recordable.cc) set_target_properties(opentelemetry_logs PROPERTIES EXPORT_NAME logs) diff --git a/sdk/src/logs/batch_log_processor_factory.cc b/sdk/src/logs/batch_log_processor_factory.cc deleted file mode 100644 index d5e825e6f5..0000000000 --- a/sdk/src/logs/batch_log_processor_factory.cc +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/sdk/logs/batch_log_processor_factory.h" -# include "opentelemetry/sdk/logs/batch_log_processor.h" - -OPENTELEMETRY_BEGIN_NAMESPACE -namespace sdk -{ -namespace logs -{ - -std::unique_ptr BatchLogProcessorFactory::Create( - std::unique_ptr &&exporter, - const BatchLogProcessorOptions &options) -{ - std::unique_ptr processor(new BatchLogProcessor(std::move(exporter), options)); - return processor; -} - -} // namespace logs -} // namespace sdk -OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/batch_log_processor.cc b/sdk/src/logs/batch_log_record_processor.cc similarity index 97% rename from sdk/src/logs/batch_log_processor.cc rename to sdk/src/logs/batch_log_record_processor.cc index 35092652cb..c9d98ee45a 100644 --- a/sdk/src/logs/batch_log_processor.cc +++ b/sdk/src/logs/batch_log_record_processor.cc @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/sdk/logs/batch_log_processor.h" +# include "opentelemetry/sdk/logs/batch_log_record_processor.h" # include "opentelemetry/common/spin_lock_mutex.h" # include @@ -14,7 +14,7 @@ namespace sdk { namespace logs { -BatchLogProcessor::BatchLogProcessor(std::unique_ptr &&exporter, +BatchLogProcessor::BatchLogProcessor(std::unique_ptr &&exporter, const size_t max_queue_size, const std::chrono::milliseconds scheduled_delay_millis, const size_t max_export_batch_size) @@ -32,7 +32,7 @@ BatchLogProcessor::BatchLogProcessor(std::unique_ptr &&exporter, synchronization_data_->is_shutdown.store(false); } -BatchLogProcessor::BatchLogProcessor(std::unique_ptr &&exporter, +BatchLogProcessor::BatchLogProcessor(std::unique_ptr &&exporter, const BatchLogProcessorOptions &options) : exporter_(std::move(exporter)), max_queue_size_(options.max_queue_size), diff --git a/sdk/src/logs/batch_log_record_processor_factory.cc b/sdk/src/logs/batch_log_record_processor_factory.cc new file mode 100644 index 0000000000..4292419053 --- /dev/null +++ b/sdk/src/logs/batch_log_record_processor_factory.cc @@ -0,0 +1,27 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#ifdef ENABLE_LOGS_PREVIEW + +# include "opentelemetry/sdk/logs/batch_log_record_processor_factory.h" +# include "opentelemetry/sdk/logs/batch_log_record_processor.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace sdk +{ +namespace logs +{ + +std::unique_ptr BatchLogProcessorFactory::Create( + std::unique_ptr &&exporter, + const BatchLogProcessorOptions &options) +{ + std::unique_ptr processor( + new BatchLogProcessor(std::move(exporter), options)); + return processor; +} + +} // namespace logs +} // namespace sdk +OPENTELEMETRY_END_NAMESPACE +#endif diff --git a/sdk/src/logs/logger_context.cc b/sdk/src/logs/logger_context.cc index dd26d7e508..e0c916e4de 100644 --- a/sdk/src/logs/logger_context.cc +++ b/sdk/src/logs/logger_context.cc @@ -4,7 +4,7 @@ #ifdef ENABLE_LOGS_PREVIEW # include "opentelemetry/sdk/logs/logger_context.h" -# include "opentelemetry/sdk/logs/multi_log_processor.h" +# include "opentelemetry/sdk/logs/multi_log_record_processor.h" # include # include @@ -15,19 +15,19 @@ namespace sdk namespace logs { -LoggerContext::LoggerContext(std::vector> &&processors, +LoggerContext::LoggerContext(std::vector> &&processors, opentelemetry::sdk::resource::Resource resource) noexcept : resource_(resource), - processor_(std::unique_ptr(new MultiLogProcessor(std::move(processors)))) + processor_(std::unique_ptr(new MultiLogProcessor(std::move(processors)))) {} -void LoggerContext::AddProcessor(std::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)); } -LogProcessor &LoggerContext::GetProcessor() const noexcept +LogRecordProcessor &LoggerContext::GetProcessor() const noexcept { return *processor_; } diff --git a/sdk/src/logs/logger_context_factory.cc b/sdk/src/logs/logger_context_factory.cc index 5cbe8b4510..985743fd67 100644 --- a/sdk/src/logs/logger_context_factory.cc +++ b/sdk/src/logs/logger_context_factory.cc @@ -15,14 +15,14 @@ namespace logs { std::unique_ptr LoggerContextFactory::Create( - std::vector> &&processors) + std::vector> &&processors) { auto resource = opentelemetry::sdk::resource::Resource::Create({}); return Create(std::move(processors), resource); } std::unique_ptr LoggerContextFactory::Create( - std::vector> &&processors, + std::vector> &&processors, const opentelemetry::sdk::resource::Resource &resource) { std::unique_ptr context(new LoggerContext(std::move(processors), resource)); diff --git a/sdk/src/logs/logger_provider.cc b/sdk/src/logs/logger_provider.cc index 86a73da382..ddd4d0cbde 100644 --- a/sdk/src/logs/logger_provider.cc +++ b/sdk/src/logs/logger_provider.cc @@ -20,23 +20,23 @@ namespace logs namespace nostd = opentelemetry::nostd; namespace logs_api = opentelemetry::logs; -LoggerProvider::LoggerProvider(std::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)); } -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))} {} LoggerProvider::LoggerProvider() noexcept - : context_{ - std::make_shared(std::vector>{})} + : context_{std::make_shared( + std::vector>{})} {} LoggerProvider::LoggerProvider(std::shared_ptr context) noexcept @@ -116,7 +116,7 @@ nostd::shared_ptr LoggerProvider::GetLogger( return GetLogger(logger_name, "", library_name, library_version, schema_url); } -void LoggerProvider::AddProcessor(std::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 8b9e6a694e..3177b9180e 100644 --- a/sdk/src/logs/logger_provider_factory.cc +++ b/sdk/src/logs/logger_provider_factory.cc @@ -14,14 +14,14 @@ namespace logs { std::unique_ptr LoggerProviderFactory::Create( - std::unique_ptr &&processor) + std::unique_ptr &&processor) { auto resource = opentelemetry::sdk::resource::Resource::Create({}); return Create(std::move(processor), resource); } std::unique_ptr LoggerProviderFactory::Create( - std::unique_ptr &&processor, + std::unique_ptr &&processor, const opentelemetry::sdk::resource::Resource &resource) { std::unique_ptr provider( @@ -30,14 +30,14 @@ std::unique_ptr LoggerProviderFactory::Crea } std::unique_ptr LoggerProviderFactory::Create( - std::vector> &&processors) + std::vector> &&processors) { auto resource = opentelemetry::sdk::resource::Resource::Create({}); return Create(std::move(processors), resource); } std::unique_ptr LoggerProviderFactory::Create( - std::vector> &&processors, + std::vector> &&processors, const opentelemetry::sdk::resource::Resource &resource) { std::unique_ptr provider( diff --git a/sdk/src/logs/multi_log_processor_factory.cc b/sdk/src/logs/multi_log_processor_factory.cc deleted file mode 100644 index a0b8a8c911..0000000000 --- a/sdk/src/logs/multi_log_processor_factory.cc +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/sdk/logs/multi_log_processor_factory.h" -# include "opentelemetry/sdk/logs/multi_log_processor.h" - -# include -# include -# include - -OPENTELEMETRY_BEGIN_NAMESPACE -namespace sdk -{ -namespace logs -{ - -std::unique_ptr MultiLogProcessorFactory::Create( - std::vector> &&processors) -{ - std::unique_ptr processor(new MultiLogProcessor(std::move(processors))); - return processor; -} - -} // namespace logs -} // namespace sdk - -OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/multi_log_processor.cc b/sdk/src/logs/multi_log_record_processor.cc similarity index 95% rename from sdk/src/logs/multi_log_processor.cc rename to sdk/src/logs/multi_log_record_processor.cc index f8de227806..2e374b83e5 100644 --- a/sdk/src/logs/multi_log_processor.cc +++ b/sdk/src/logs/multi_log_record_processor.cc @@ -3,7 +3,7 @@ #ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/sdk/logs/multi_log_processor.h" +# include "opentelemetry/sdk/logs/multi_log_record_processor.h" # include # include @@ -15,7 +15,7 @@ namespace sdk namespace logs { -MultiLogProcessor::MultiLogProcessor(std::vector> &&processors) +MultiLogProcessor::MultiLogProcessor(std::vector> &&processors) { for (auto &processor : processors) { @@ -28,7 +28,7 @@ MultiLogProcessor::~MultiLogProcessor() Shutdown(); } -void MultiLogProcessor::AddProcessor(std::unique_ptr &&processor) +void MultiLogProcessor::AddProcessor(std::unique_ptr &&processor) { // Add preocessor to end of the list. if (processor) diff --git a/sdk/src/logs/multi_log_record_processor_factory.cc b/sdk/src/logs/multi_log_record_processor_factory.cc new file mode 100644 index 0000000000..77e2d1b089 --- /dev/null +++ b/sdk/src/logs/multi_log_record_processor_factory.cc @@ -0,0 +1,30 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#ifdef ENABLE_LOGS_PREVIEW + +# include "opentelemetry/sdk/logs/multi_log_record_processor_factory.h" +# include "opentelemetry/sdk/logs/multi_log_record_processor.h" + +# include +# include +# include + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace sdk +{ +namespace logs +{ + +std::unique_ptr MultiLogProcessorFactory::Create( + std::vector> &&processors) +{ + std::unique_ptr processor(new MultiLogProcessor(std::move(processors))); + return processor; +} + +} // namespace logs +} // namespace sdk + +OPENTELEMETRY_END_NAMESPACE +#endif diff --git a/sdk/src/logs/multi_recordable.cc b/sdk/src/logs/multi_recordable.cc index 532dfcf65a..c91ffc6b82 100644 --- a/sdk/src/logs/multi_recordable.cc +++ b/sdk/src/logs/multi_recordable.cc @@ -17,21 +17,21 @@ namespace logs namespace { -std::size_t MakeKey(const opentelemetry::sdk::logs::LogProcessor &processor) +std::size_t MakeKey(const opentelemetry::sdk::logs::LogRecordProcessor &processor) { return reinterpret_cast(&processor); } } // namespace -void MultiRecordable::AddRecordable(const LogProcessor &processor, +void MultiRecordable::AddRecordable(const LogRecordProcessor &processor, std::unique_ptr recordable) noexcept { recordables_[MakeKey(processor)] = std::move(recordable); } const std::unique_ptr &MultiRecordable::GetRecordable( - const LogProcessor &processor) const noexcept + const LogRecordProcessor &processor) const noexcept { // TODO - return nullptr ref on failed lookup? auto i = recordables_.find(MakeKey(processor)); @@ -44,7 +44,7 @@ const std::unique_ptr &MultiRecordable::GetRecordable( } std::unique_ptr MultiRecordable::ReleaseRecordable( - const LogProcessor &processor) noexcept + const LogRecordProcessor &processor) noexcept { auto i = recordables_.find(MakeKey(processor)); if (i != recordables_.end()) diff --git a/sdk/src/logs/simple_log_processor_factory.cc b/sdk/src/logs/simple_log_processor_factory.cc deleted file mode 100644 index 25cf46521e..0000000000 --- a/sdk/src/logs/simple_log_processor_factory.cc +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/sdk/logs/simple_log_processor_factory.h" -# include "opentelemetry/sdk/logs/simple_log_processor.h" - -OPENTELEMETRY_BEGIN_NAMESPACE -namespace sdk -{ -namespace logs -{ - -std::unique_ptr SimpleLogProcessorFactory::Create( - std::unique_ptr &&exporter) -{ - std::unique_ptr processor(new SimpleLogProcessor(std::move(exporter))); - return processor; -} - -} // namespace logs -} // namespace sdk -OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/simple_log_processor.cc b/sdk/src/logs/simple_log_record_processor.cc similarity index 91% rename from sdk/src/logs/simple_log_processor.cc rename to sdk/src/logs/simple_log_record_processor.cc index 3d5d798c0a..e970ceb5ba 100644 --- a/sdk/src/logs/simple_log_processor.cc +++ b/sdk/src/logs/simple_log_record_processor.cc @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/sdk/logs/simple_log_processor.h" +# include "opentelemetry/sdk/logs/simple_log_record_processor.h" # include # include @@ -16,7 +16,7 @@ namespace logs * Initialize a simple log processor. * @param exporter the configured exporter where log records are sent */ -SimpleLogProcessor::SimpleLogProcessor(std::unique_ptr &&exporter) +SimpleLogProcessor::SimpleLogProcessor(std::unique_ptr &&exporter) : exporter_(std::move(exporter)), is_shutdown_(false) {} diff --git a/sdk/src/logs/simple_log_record_processor_factory.cc b/sdk/src/logs/simple_log_record_processor_factory.cc new file mode 100644 index 0000000000..9320ad7ff4 --- /dev/null +++ b/sdk/src/logs/simple_log_record_processor_factory.cc @@ -0,0 +1,25 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#ifdef ENABLE_LOGS_PREVIEW + +# include "opentelemetry/sdk/logs/simple_log_record_processor_factory.h" +# include "opentelemetry/sdk/logs/simple_log_record_processor.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace sdk +{ +namespace logs +{ + +std::unique_ptr SimpleLogProcessorFactory::Create( + std::unique_ptr &&exporter) +{ + std::unique_ptr processor(new SimpleLogProcessor(std::move(exporter))); + return processor; +} + +} // namespace logs +} // namespace sdk +OPENTELEMETRY_END_NAMESPACE +#endif diff --git a/sdk/test/logs/BUILD b/sdk/test/logs/BUILD index c8f051070f..edf3a9a8d3 100644 --- a/sdk/test/logs/BUILD +++ b/sdk/test/logs/BUILD @@ -30,9 +30,9 @@ cc_test( ) cc_test( - name = "simple_log_processor_test", + name = "simple_log_record_processor_test", srcs = [ - "simple_log_processor_test.cc", + "simple_log_record_processor_test.cc", ], tags = [ "logs", @@ -60,9 +60,9 @@ cc_test( ) cc_test( - name = "batch_log_processor_test", + name = "batch_log_record_processor_test", srcs = [ - "batch_log_processor_test.cc", + "batch_log_record_processor_test.cc", ], tags = [ "logs", diff --git a/sdk/test/logs/CMakeLists.txt b/sdk/test/logs/CMakeLists.txt index 84b865d226..23d2a89f21 100644 --- a/sdk/test/logs/CMakeLists.txt +++ b/sdk/test/logs/CMakeLists.txt @@ -1,5 +1,6 @@ -foreach(testname logger_provider_sdk_test logger_sdk_test log_record_test - simple_log_processor_test batch_log_processor_test) +foreach(testname + logger_provider_sdk_test logger_sdk_test log_record_test + simple_log_record_processor_test batch_log_record_processor_test) add_executable(${testname} "${testname}.cc") target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} opentelemetry_logs) diff --git a/sdk/test/logs/batch_log_processor_test.cc b/sdk/test/logs/batch_log_record_processor_test.cc similarity index 96% rename from sdk/test/logs/batch_log_processor_test.cc rename to sdk/test/logs/batch_log_record_processor_test.cc index b6fb240ee5..e8fc17dd26 100644 --- a/sdk/test/logs/batch_log_processor_test.cc +++ b/sdk/test/logs/batch_log_record_processor_test.cc @@ -3,7 +3,7 @@ #ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/sdk/logs/batch_log_processor.h" +# include "opentelemetry/sdk/logs/batch_log_record_processor.h" # include "opentelemetry/sdk/logs/exporter.h" # include "opentelemetry/sdk/logs/log_record.h" @@ -19,7 +19,7 @@ using namespace opentelemetry::sdk::common; * A sample log exporter * for testing the batch log processor */ -class MockLogExporter final : public LogExporter +class MockLogExporter final : public LogRecordExporter { public: MockLogExporter(std::shared_ptr>> logs_received, @@ -78,7 +78,7 @@ class BatchLogProcessorTest : public testing::Test // ::testing::Test public: // 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 GetMockProcessor( std::shared_ptr>> logs_received, std::shared_ptr> is_shutdown, std::shared_ptr> is_export_completed = @@ -88,8 +88,8 @@ class BatchLogProcessorTest : public testing::Test // ::testing::Test const size_t max_queue_size = 2048, const size_t max_export_batch_size = 512) { - return std::shared_ptr( - new BatchLogProcessor(std::unique_ptr(new MockLogExporter( + return std::shared_ptr( + new BatchLogProcessor(std::unique_ptr(new MockLogExporter( logs_received, is_shutdown, is_export_completed, export_delay)), max_queue_size, scheduled_delay_millis, max_export_batch_size)); } diff --git a/sdk/test/logs/logger_provider_sdk_test.cc b/sdk/test/logs/logger_provider_sdk_test.cc index 6bf738e812..022fffe72d 100644 --- a/sdk/test/logs/logger_provider_sdk_test.cc +++ b/sdk/test/logs/logger_provider_sdk_test.cc @@ -10,7 +10,7 @@ # include "opentelemetry/sdk/logs/log_record.h" # include "opentelemetry/sdk/logs/logger.h" # include "opentelemetry/sdk/logs/logger_provider.h" -# include "opentelemetry/sdk/logs/simple_log_processor.h" +# include "opentelemetry/sdk/logs/simple_log_record_processor.h" # include @@ -79,7 +79,7 @@ TEST(LoggerProviderSDK, LoggerProviderLoggerArguments) ASSERT_EQ(sdk_logger2->GetInstrumentationScope(), sdk_logger1->GetInstrumentationScope()); } -class DummyProcessor : public LogProcessor +class DummyProcessor : public LogRecordProcessor { std::unique_ptr MakeRecordable() noexcept override { @@ -103,7 +103,7 @@ TEST(LoggerProviderSDK, Shutdown) { std::unique_ptr processor(new SimpleLogProcessor(nullptr)); SimpleLogProcessor *processor_ptr = processor.get(); - std::vector> processors; + std::vector> processors; processors.push_back(std::move(processor)); LoggerProvider lp(std::make_shared(std::move(processors))); @@ -118,7 +118,7 @@ TEST(LoggerProviderSDK, Shutdown) TEST(LoggerProviderSDK, ForceFlush) { std::unique_ptr processor(new SimpleLogProcessor(nullptr)); - std::vector> processors; + 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 91279341c6..478d874b8e 100644 --- a/sdk/test/logs/logger_sdk_test.cc +++ b/sdk/test/logs/logger_sdk_test.cc @@ -29,7 +29,7 @@ TEST(LoggerSDK, LogToNullProcessor) logger->Debug("Test log"); } -class MockProcessor final : public LogProcessor +class MockProcessor final : public LogRecordProcessor { private: std::shared_ptr record_received_; @@ -81,7 +81,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 LogRecord()); - lp->AddProcessor(std::unique_ptr(new MockProcessor(shared_recordable))); + lp->AddProcessor(std::unique_ptr(new MockProcessor(shared_recordable))); // Check that the recordable created by the Log() statement is set properly logger->Log(logs_api::Severity::kWarn, "Log Message"); diff --git a/sdk/test/logs/simple_log_processor_test.cc b/sdk/test/logs/simple_log_record_processor_test.cc similarity index 96% rename from sdk/test/logs/simple_log_processor_test.cc rename to sdk/test/logs/simple_log_record_processor_test.cc index 008ca7c522..99351881d9 100644 --- a/sdk/test/logs/simple_log_processor_test.cc +++ b/sdk/test/logs/simple_log_record_processor_test.cc @@ -3,7 +3,7 @@ #ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/sdk/logs/simple_log_processor.h" +# include "opentelemetry/sdk/logs/simple_log_record_processor.h" # include "opentelemetry/nostd/span.h" # include "opentelemetry/sdk/logs/exporter.h" # include "opentelemetry/sdk/logs/log_record.h" @@ -21,7 +21,7 @@ namespace nostd = opentelemetry::nostd; * A test exporter that can return a vector of all the records it has received, * and keep track of the number of times its Shutdown() function was called. */ -class TestExporter final : public LogExporter +class TestExporter final : public LogRecordExporter { public: TestExporter(int *shutdown_counter, @@ -122,7 +122,7 @@ TEST(SimpleLogProcessorTest, ShutdownCalledOnce) } // A test exporter that always returns failure when shut down -class FailShutDownExporter final : public LogExporter +class FailShutDownExporter final : public LogRecordExporter { public: FailShutDownExporter() {} From 01cad63d4c65285d8006018eaf8f0149441c9310 Mon Sep 17 00:00:00 2001 From: owent Date: Tue, 1 Nov 2022 16:55:33 +0800 Subject: [PATCH 2/2] Add changelog Signed-off-by: owent --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4368f441dd..b733bae66b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ Increment the: ## [Unreleased] +* [LOGS SDK] Rename LogProcessor and LogExporter to LogRecordProcessor and LogRecordExporter + [#1727](https://github.com/open-telemetry/opentelemetry-cpp/pull/1727) + ## [1.7.0] 2022-10-28 * [METRICS SDK] Validate Instrument meta data (name, unit, description) [#1713](https://github.com/open-telemetry/opentelemetry-cpp/pull/1713)