Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions exporters/fluentd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,22 @@ if(OPENTELEMETRY_INSTALL)
endif()

if(BUILD_TESTING)
include(GoogleTest)
if(MAIN_PROJECT)
find_package(GTest CONFIG REQUIRED)
else()
if (NOT DEFINED GTEST_BOTH_LIBRARIES)
message(STATUS_FATAL, "Test is not enable.")
endif()
endif()
# include(GoogleTest)
# build trace exporter tests
add_executable(
fluentd_recordable_trace_test test/trace/fluentd_recordable_test.cc
test/trace/fluentd_baseline_test.cc)

target_link_libraries(
fluentd_recordable_trace_test
gtest
gtest_main
${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
opentelemetry_common
opentelemetry_trace
Expand All @@ -164,8 +170,7 @@ if(BUILD_TESTING)

target_link_libraries(
fluentd_recordable_logs_test
gtest
gtest_main
${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
opentelemetry_common
opentelemetry_logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ class FluentdExporter final : public logs_sdk::LogRecordExporter {
Export(const nostd::span<std::unique_ptr<logs_sdk::Recordable>>
&logs) noexcept override;

bool ForceFlush(
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override
{
Copy link
Member

@lalitb lalitb Jan 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why are we overriding the default forceflush here, which this is also empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ForceFlush from SDK is marked as pure, so we need provide an empty body here.

  virtual bool ForceFlush(
      std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0;

https://github.com/open-telemetry/opentelemetry-cpp/blob/6603c3a0f10ed907b33979443d0423306fa208e6/sdk/include/opentelemetry/sdk/logs/exporter.h#L54

return true;
}

/**
* Shut down the exporter.
* @param timeout an optional timeout, default to max.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ class FluentdExporter final : public trace_sdk::SpanExporter {
Export(const nostd::span<std::unique_ptr<trace_sdk::Recordable>>
&spans) noexcept override;

bool ForceFlush(
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override
{
return true;
}

/**
* Shut down the exporter.
* @param timeout an optional timeout, default to max.
Expand Down