Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Logs SDK] LogProcessor, LogExporter changes #1727

Merged
merged 3 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
62 changes: 31 additions & 31 deletions cmake/opentelemetry-cpp-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
#

# =============================================================================
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/otlp/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)
Expand All @@ -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",
],
)
Expand Down
4 changes: 2 additions & 2 deletions examples/otlp/grpc_log_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions examples/otlp/http_log_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 6 additions & 6 deletions exporters/elasticsearch/BUILD
Original file line number Diff line number Diff line change
@@ -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({
Expand All @@ -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",
],
Expand Down
16 changes: 9 additions & 7 deletions exporters/elasticsearch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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:
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# include <condition_variable>
# include <mutex>
# 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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gtest/gtest.h>
# include <iostream>
Expand All @@ -33,7 +33,7 @@ TEST(ElasticsearchLogsExporterTests, InvalidEndpoint)

// Create an elasticsearch exporter
auto exporter =
std::unique_ptr<sdklogs::LogExporter>(new logs_exporter::ElasticsearchLogExporter(options));
std::unique_ptr<sdklogs::LogRecordExporter>(new logs_exporter::ElasticsearchLogExporter(options));

// Create a log record and send to the exporter
auto record = exporter->MakeRecordable();
Expand All @@ -48,7 +48,7 @@ TEST(ElasticsearchLogsExporterTests, Shutdown)
{
// Create an elasticsearch exporter and immediately shut it down
auto exporter =
std::unique_ptr<sdklogs::LogExporter>(new logs_exporter::ElasticsearchLogExporter);
std::unique_ptr<sdklogs::LogRecordExporter>(new logs_exporter::ElasticsearchLogExporter);
bool shutdownResult = exporter->Shutdown();
ASSERT_TRUE(shutdownResult);

Expand All @@ -65,7 +65,7 @@ TEST(ElasticsearchLogsExporterTests, RecordableCreation)
{
// Create an elasticsearch exporter
auto exporter =
std::unique_ptr<sdklogs::LogExporter>(new logs_exporter::ElasticsearchLogExporter);
std::unique_ptr<sdklogs::LogRecordExporter>(new logs_exporter::ElasticsearchLogExporter);

// Create a recordable
auto record = exporter->MakeRecordable();
Expand Down
8 changes: 4 additions & 4 deletions exporters/ostream/BUILD
Original file line number Diff line number Diff line change
@@ -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"],
Expand All @@ -24,7 +24,7 @@ cc_test(
"test",
],
deps = [
":ostream_log_exporter",
":ostream_log_record_exporter",
"@com_google_googletest//:gtest_main",
],
)
Expand Down
6 changes: 3 additions & 3 deletions exporters/ostream/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>")
Expand All @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <mutex>
# include "opentelemetry/exporters/ostream/common_utils.h"
# include "opentelemetry/sdk_config.h"
Expand Down
Loading