Integrate prometheus-enabled Broker

This commit is contained in:
Dominik Charousset 2024-06-21 17:11:58 +02:00
parent eb5ea66012
commit f1d65b7dbf
4 changed files with 20 additions and 10 deletions

View file

@ -338,12 +338,11 @@ add_zeek_dynamic_plugin_build_interface_include_directories(
${PROJECT_SOURCE_DIR}/auxil/broker/libbroker ${PROJECT_SOURCE_DIR}/auxil/broker/libbroker
${PROJECT_SOURCE_DIR}/auxil/paraglob/include ${PROJECT_SOURCE_DIR}/auxil/paraglob/include
${PROJECT_SOURCE_DIR}/auxil/rapidjson/include ${PROJECT_SOURCE_DIR}/auxil/rapidjson/include
${PROJECT_SOURCE_DIR}/auxil/prometheus-cpp/core/include
${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/src
${CMAKE_BINARY_DIR}/src/include ${CMAKE_BINARY_DIR}/src/include
${CMAKE_BINARY_DIR}/auxil/binpac/lib ${CMAKE_BINARY_DIR}/auxil/binpac/lib
${CMAKE_BINARY_DIR}/auxil/broker/libbroker ${CMAKE_BINARY_DIR}/auxil/broker/libbroker
${CMAKE_BINARY_DIR}/auxil/prometheus-cpp/core/include) ${CMAKE_BINARY_DIR}/zeek-bundle/include/prometheus)
# threading/formatters/JSON.h includes rapidjson headers and may be used # threading/formatters/JSON.h includes rapidjson headers and may be used
# by external plugins, extend the include path. # by external plugins, extend the include path.
@ -897,6 +896,21 @@ if (MSVC)
endif () endif ()
set(zeekdeps ${zeekdeps} paraglob) set(zeekdeps ${zeekdeps} paraglob)
include(cmake/ZeekBundle.cmake)
zeekbundle_add(
NAME
prometheus-cpp
FETCH
SOURCE_DIR
"${PROJECT_SOURCE_DIR}/auxil/prometheus-cpp"
CONFIGURE
CMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}
CMAKE_MSVC_RUNTIME_LIBRARY_FLAG=${CMAKE_MSVC_RUNTIME_LIBRARY_FLAG}
ENABLE_COMPRESSION=OFF
ENABLE_PUSH=OFF)
target_link_libraries(zeek_internal INTERFACE $<BUILD_INTERFACE:prometheus-cpp::core>
$<BUILD_INTERFACE:prometheus-cpp::pull>)
# Note: Broker gets some special attention in ZeekConfig.cmake.in. # Note: Broker gets some special attention in ZeekConfig.cmake.in.
if (Broker_ROOT) if (Broker_ROOT)
find_package(Broker REQUIRED CONFIG) find_package(Broker REQUIRED CONFIG)
@ -1018,10 +1032,7 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auxil/rapidjson/include/rapidjson
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auxil/filesystem/include/ghc install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auxil/filesystem/include/ghc
DESTINATION include/zeek/3rdparty/) DESTINATION include/zeek/3rdparty/)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auxil/prometheus-cpp/core/include/prometheus install(DIRECTORY ${CMAKE_BINARY_DIR}/zeek-bundle/include/prometheus
DESTINATION include/zeek/3rdparty/prometheus-cpp/include)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/auxil/prometheus-cpp/core/include/prometheus
DESTINATION include/zeek/3rdparty/prometheus-cpp/include) DESTINATION include/zeek/3rdparty/prometheus-cpp/include)
# Create 3rdparty/ghc within the build directory so that the include for # Create 3rdparty/ghc within the build directory so that the include for
@ -1135,7 +1146,6 @@ include(GetArchitecture)
include(FindCAres) include(FindCAres)
include(FindKqueue) include(FindKqueue)
include(FindPrometheusCpp)
include_directories(BEFORE "auxil/out_ptr/include") include_directories(BEFORE "auxil/out_ptr/include")
if ((OPENSSL_VERSION VERSION_EQUAL "1.1.0") OR (OPENSSL_VERSION VERSION_GREATER "1.1.0")) if ((OPENSSL_VERSION VERSION_EQUAL "1.1.0") OR (OPENSSL_VERSION VERSION_GREATER "1.1.0"))

@ -1 +1 @@
Subproject commit c529c38de3d540953e799a83c44683a3413a1a14 Subproject commit a7591244eac134042764bd3302dbda48b6ac026c

2
cmake

@ -1 +1 @@
Subproject commit 2df3b8e82a843b7b8187963d259d32a9fb42b873 Subproject commit 12da4a26c0960da6b31eb8be1cf03025c80570cd

View file

@ -189,7 +189,7 @@ struct opt_mapping {
class BrokerState { class BrokerState {
public: public:
BrokerState(broker::configuration config, size_t congestion_queue_size) BrokerState(broker::configuration config, size_t congestion_queue_size)
: endpoint(std::move(config)), : endpoint(std::move(config), telemetry_mgr->GetRegistry()),
subscriber( subscriber(
endpoint.make_subscriber({broker::topic::statuses(), broker::topic::errors()}, congestion_queue_size)) {} endpoint.make_subscriber({broker::topic::statuses(), broker::topic::errors()}, congestion_queue_size)) {}