Skip to content
Open
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
21 changes: 19 additions & 2 deletions components/core/cmake/Options/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ option(
ON
)

option(
CLP_BUILD_CLP_S_SEARCH_ENABLE_OPENTELEMETRY_CPP
"Include open telemetry support for clp_s::search."
Comment on lines +99 to +100

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
CLP_BUILD_CLP_S_SEARCH_ENABLE_OPENTELEMETRY_CPP
"Include open telemetry support for clp_s::search."
CLP_BUILD_CLP_S_ENABLE_OPENTELEMETRY
"Include open telemetry support for clp-s."

Could we rename the flag (and other corresponding functions, etc.) to this? If we did add opentelemetry support to other parts of clp-s we'd probably want to share the same flag, instead of relying on a different flag for each sub-component, so we might as well just create a flag at the clp-s level now.

ON
)

option(
CLP_BUILD_CLP_S_SEARCH_KQL
"Build clp_s::search::kql."
Expand Down Expand Up @@ -311,6 +317,8 @@ endfunction()
function(validate_clp_s_ffi_sfa_dependencies)
validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_FFI_SFA
CLP_BUILD_CLP_S_ARCHIVEREADER
CLP_BUILD_CLP_S_SEARCH
CLP_BUILD_CLP_S_SEARCH_KQL
)
endfunction()

Expand Down Expand Up @@ -392,10 +400,8 @@ function(set_clp_s_search_dependencies)
set_clp_need_flags(
CLP_NEED_ABSL
CLP_NEED_LOG_SURGEON
CLP_NEED_OPENTELEMETRY_CPP
CLP_NEED_SIMDJSON
CLP_NEED_SPDLOG
CLP_NEED_XXHASH
)
endfunction()

Expand All @@ -405,6 +411,13 @@ function(set_clp_s_search_ast_dependencies)
)
endfunction()

function(set_clp_s_search_enable_opentelemetry_cpp_dependencies)
set_clp_need_flags(
CLP_NEED_OPENTELEMETRY_CPP
CLP_NEED_XXHASH
)
endfunction()
Comment thread
coderabbitai[bot] marked this conversation as resolved.

function(validate_clp_s_search_kql_dependencies)
validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_SEARCH_KQL
CLP_BUILD_CLP_STRING_UTILS
Expand Down Expand Up @@ -538,6 +551,10 @@ function(validate_and_setup_all_clp_dependency_flags)
set_clp_s_search_ast_dependencies()
endif()

if (CLP_BUILD_CLP_S_SEARCH_ENABLE_OPENTELEMETRY_CPP)
set_clp_s_search_enable_opentelemetry_cpp_dependencies()
endif()

if (CLP_BUILD_CLP_S_SEARCH_KQL)
validate_clp_s_search_kql_dependencies()
set_clp_s_search_kql_dependencies()
Expand Down
5 changes: 3 additions & 2 deletions components/core/src/clp_s/InputConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
#if CLP_BUILD_CLP_S_ENABLE_LIBARCHIVE
#include <archive.h>
#include <archive_entry.h>

#include "../clp/LibarchiveFileReader.hpp"
#include "../clp/LibarchiveReader.hpp"
#endif

#include <simdjson.h>
Expand All @@ -27,8 +30,6 @@
#include "../clp/ErrorCode.hpp"
#include "../clp/ffi/ir_stream/protocol_constants.hpp"
#include "../clp/FileReader.hpp"
#include "../clp/LibarchiveFileReader.hpp"
#include "../clp/LibarchiveReader.hpp"
#include "../clp/ReaderInterface.hpp"
#include "../clp/spdlog_with_specializations.hpp"
#include "../clp/streaming_compression/Decompressor.hpp"
Expand Down
1 change: 1 addition & 0 deletions components/core/src/clp_s/ffi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ if(CLP_BUILD_CLP_S_FFI_SFA)
clp_s_ffi_sfa
PUBLIC
clp_s::archive_reader
clp_s::search

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
clp_s::search

Not used in this PR? Should probably be part of the PR where you add search to the ffi.

ystdlib::error_handling
PRIVATE
spdlog::spdlog
Expand Down
31 changes: 24 additions & 7 deletions components/core/src/clp_s/search/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ set(
QueryRunner.hpp
SchemaMatch.cpp
SchemaMatch.hpp
SearchTelemetry.cpp
SearchTelemetry.hpp
TelemetryContext.cpp
TelemetryContext.hpp
)

Expand All @@ -47,11 +45,30 @@ if(CLP_BUILD_CLP_S_SEARCH)
clp::string_utils
clp_s::clp_dependencies
clp_s::io
opentelemetry-cpp::api
opentelemetry-cpp::otlp_http_exporter
opentelemetry-cpp::resources
opentelemetry-cpp::trace
spdlog::spdlog
xxHash::xxhash
)
if(CLP_BUILD_CLP_S_SEARCH_ENABLE_OPENTELEMETRY_CPP)
target_sources(
clp_s_search
PRIVATE
SearchTelemetry.cpp
TelemetryContext.cpp
)
target_link_libraries(
clp_s_search
PRIVATE
opentelemetry-cpp::api
opentelemetry-cpp::otlp_http_exporter
opentelemetry-cpp::resources
opentelemetry-cpp::trace
xxHash::xxhash
)
else()
target_sources(
clp_s_search
PRIVATE
SearchTelemetryNoop.cpp
TelemetryContextNoop.cpp
Comment on lines +70 to +71

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of adding new cpp files let's use the more standard approach of doing:

target_compile_definitions(
        clp_s_search
        PRIVATE
        CLP_BUILD_CLP_S_ENABLE_OPENTELEMETRY=$<BOOL:${CLP_BUILD_CLP_S_ENABLE_OPENTELEMETRY}>
)

Then use #if ... macros to stub out implementations in the existing cpp files.

)
endif()
endif()
33 changes: 33 additions & 0 deletions components/core/src/clp_s/search/SearchTelemetryNoop.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <memory>
#include <optional>
#include <string_view>

#include "SearchTelemetry.hpp"

namespace clp_s::search {
class SearchTelemetrySpan::Impl {};

SearchTelemetrySpan::SearchTelemetrySpan() : m_impl{std::make_unique<Impl>()} {}

SearchTelemetrySpan::~SearchTelemetrySpan() = default;

auto SearchTelemetrySpan::set_archive_context(std::string_view) -> void {}

auto SearchTelemetrySpan::set_error(std::string_view) -> void {}

auto SearchTelemetrySpan::set_query_context(std::string_view) -> void {}

auto SearchTelemetrySpan::set_query_shape_metrics(QueryShapeMetrics const&) -> void {}

auto SearchTelemetrySpan::set_search_result_metrics(SearchResultMetrics const&) -> void {}

auto SearchTelemetrySpan::set_termination_stage(std::string_view) -> void {}

auto QueryShapeMetrics::create(
std::shared_ptr<ast::Expression> const&,
std::optional<epochtime_t>,
std::optional<epochtime_t>
) -> QueryShapeMetrics {
return {};
}
} // namespace clp_s::search
11 changes: 11 additions & 0 deletions components/core/src/clp_s/search/TelemetryContextNoop.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <memory>

#include "TelemetryContext.hpp"

namespace clp_s::search {
class TelemetryContext::Impl {};

TelemetryContext::TelemetryContext() : m_impl{std::make_unique<Impl>()} {}

TelemetryContext::~TelemetryContext() = default;
} // namespace clp_s::search
Loading