diff --git a/CMake/FindPrometheuscpp.cmake b/CMake/FindPrometheuscpp.cmake new file mode 100644 index 0000000000000000000000000000000000000000..48264a06971dd7b4e8fe99a95bd61a35439abcc8 --- /dev/null +++ b/CMake/FindPrometheuscpp.cmake @@ -0,0 +1,65 @@ +# FindPrometheuscpp.cmake +# +# Finds the prometheus-cpp library +# +# This will define the following variables: +# +# Prometheuscpp_FOUND +# Prometheuscpp_INCLUDE_DIRS +# Prometheuscpp_LIBRARIES +# +# And the following imported targets: +# +# prometheus-cpp::core +# prometheus-cpp::pull +# prometheus-cpp::push +# + +find_package(PkgConfig) +pkg_check_modules(PC_Prometheuscpp QUIET prometheus-cpp-core prometheus-cpp-pull prometheus-cpp-push) + +find_path(Prometheuscpp_INCLUDE_DIR + NAMES prometheus/registry.h + HINTS ${PC_Prometheuscpp_INCLUDE_DIRS} +) + +foreach(COMPONENT core pull push) + string(TOUPPER ${COMPONENT} COMPONENT_UPPER) + find_library(Prometheuscpp_${COMPONENT_UPPER}_LIBRARY + NAMES prometheus-cpp-${COMPONENT} + HINTS ${PC_Prometheuscpp_LIBRARY_DIRS} + ) +endforeach() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Prometheuscpp + REQUIRED_VARS Prometheuscpp_CORE_LIBRARY Prometheuscpp_PULL_LIBRARY Prometheuscpp_PUSH_LIBRARY Prometheuscpp_INCLUDE_DIR + VERSION_VAR PC_Prometheuscpp_VERSION +) + +if(Prometheuscpp_FOUND) + set(Prometheuscpp_LIBRARIES ${Prometheuscpp_CORE_LIBRARY} ${Prometheuscpp_PULL_LIBRARY} ${Prometheuscpp_PUSH_LIBRARY}) + set(Prometheuscpp_INCLUDE_DIRS ${Prometheuscpp_INCLUDE_DIR}) + + if(NOT TARGET prometheus-cpp::core) + add_library(prometheus-cpp::core UNKNOWN IMPORTED) + set_target_properties(prometheus-cpp::core PROPERTIES + IMPORTED_LOCATION "${Prometheuscpp_CORE_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${Prometheuscpp_INCLUDE_DIR}" + ) + endif() + + foreach(COMPONENT pull push) + string(TOUPPER ${COMPONENT} COMPONENT_UPPER) + if(NOT TARGET prometheus-cpp::${COMPONENT}) + add_library(prometheus-cpp::${COMPONENT} UNKNOWN IMPORTED) + set_target_properties(prometheus-cpp::${COMPONENT} PROPERTIES + IMPORTED_LOCATION "${Prometheuscpp_${COMPONENT_UPPER}_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${Prometheuscpp_INCLUDE_DIR}" + ) + target_link_libraries(prometheus-cpp::${COMPONENT} INTERFACE prometheus-cpp::core) + endif() + endforeach() +endif() + +mark_as_advanced(Prometheuscpp_INCLUDE_DIR Prometheuscpp_CORE_LIBRARY Prometheuscpp_PULL_LIBRARY Prometheuscpp_PUSH_LIBRARY) diff --git a/CMakeLists.txt b/CMakeLists.txt index fbbe38282744282185452931af7cfcbf30671c09..0417a2718b9b3759d5ed5674196f3f9d0f81b277 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -206,7 +206,7 @@ endif () ### prometheus-cpp::core, and curl imported targets if (GKFS_ENABLE_PROMETHEUS) find_package(CURL 7.68.0 REQUIRED) - find_package(prometheus-cpp REQUIRED) # >= 1.0.0 + find_package(Prometheuscpp REQUIRED) endif () ### Other stuff that can be found out using find_package: diff --git a/examples/gfind/CMakeLists.txt b/examples/gfind/CMakeLists.txt index 38156271f6f4044e11f1d090086003a45ca90c3d..ae6e202c3e1cb94b0cd4186735f94c42ff58e580 100644 --- a/examples/gfind/CMakeLists.txt +++ b/examples/gfind/CMakeLists.txt @@ -29,7 +29,7 @@ set (CMAKE_CXX_STANDARD 17) add_executable(sfind sfind.cpp) -target_link_libraries(sfind PRIVATE ZStd::ZStd) +target_link_libraries(sfind PRIVATE ZStd::ZStd Threads::Threads) set_property(TARGET sfind PROPERTY POSITION_INDEPENDENT_CODE ON) if(GKFS_INSTALL_TESTS) install(TARGETS sfind diff --git a/src/daemon/handler/srv_metadata.cpp b/src/daemon/handler/srv_metadata.cpp index 42b66114f69de073617f7931e377730e31730171..9c40811606ad32258d1e22d85644a8f9520244a6 100644 --- a/src/daemon/handler/srv_metadata.cpp +++ b/src/daemon/handler/srv_metadata.cpp @@ -702,7 +702,11 @@ rpc_srv_get_dirents(hg_handle_t handle) { } // Respond - out.dirents_size = transfer_size; + if(gkfs::config::rpc::use_dirents_compression) { + out.dirents_size = transfer_size; + } else { + out.dirents_size = entries.size(); + } out.err = 0; GKFS_DATA->spdlogger()->debug(