From f1d65b7dbf30a0f0ecad100fe471620573cb6853 Mon Sep 17 00:00:00 2001 From: Dominik Charousset Date: Fri, 21 Jun 2024 17:11:58 +0200 Subject: [PATCH] Integrate prometheus-enabled Broker --- CMakeLists.txt | 24 +++++++++++++++++------- auxil/broker | 2 +- cmake | 2 +- src/broker/Manager.cc | 2 +- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 13ea5a5fe2..14be7998f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -338,12 +338,11 @@ add_zeek_dynamic_plugin_build_interface_include_directories( ${PROJECT_SOURCE_DIR}/auxil/broker/libbroker ${PROJECT_SOURCE_DIR}/auxil/paraglob/include ${PROJECT_SOURCE_DIR}/auxil/rapidjson/include - ${PROJECT_SOURCE_DIR}/auxil/prometheus-cpp/core/include ${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/src/include ${CMAKE_BINARY_DIR}/auxil/binpac/lib ${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 # by external plugins, extend the include path. @@ -897,6 +896,21 @@ if (MSVC) endif () 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 $ + $) + # Note: Broker gets some special attention in ZeekConfig.cmake.in. if (Broker_ROOT) 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 DESTINATION include/zeek/3rdparty/) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auxil/prometheus-cpp/core/include/prometheus - DESTINATION include/zeek/3rdparty/prometheus-cpp/include) - -install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/auxil/prometheus-cpp/core/include/prometheus +install(DIRECTORY ${CMAKE_BINARY_DIR}/zeek-bundle/include/prometheus DESTINATION include/zeek/3rdparty/prometheus-cpp/include) # Create 3rdparty/ghc within the build directory so that the include for @@ -1135,7 +1146,6 @@ include(GetArchitecture) include(FindCAres) include(FindKqueue) -include(FindPrometheusCpp) include_directories(BEFORE "auxil/out_ptr/include") if ((OPENSSL_VERSION VERSION_EQUAL "1.1.0") OR (OPENSSL_VERSION VERSION_GREATER "1.1.0")) diff --git a/auxil/broker b/auxil/broker index c529c38de3..a7591244ea 160000 --- a/auxil/broker +++ b/auxil/broker @@ -1 +1 @@ -Subproject commit c529c38de3d540953e799a83c44683a3413a1a14 +Subproject commit a7591244eac134042764bd3302dbda48b6ac026c diff --git a/cmake b/cmake index 2df3b8e82a..12da4a26c0 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 2df3b8e82a843b7b8187963d259d32a9fb42b873 +Subproject commit 12da4a26c0960da6b31eb8be1cf03025c80570cd diff --git a/src/broker/Manager.cc b/src/broker/Manager.cc index 3b6350bf29..015f53d10e 100644 --- a/src/broker/Manager.cc +++ b/src/broker/Manager.cc @@ -189,7 +189,7 @@ struct opt_mapping { class BrokerState { public: BrokerState(broker::configuration config, size_t congestion_queue_size) - : endpoint(std::move(config)), + : endpoint(std::move(config), telemetry_mgr->GetRegistry()), subscriber( endpoint.make_subscriber({broker::topic::statuses(), broker::topic::errors()}, congestion_queue_size)) {}