summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorVladimir Kobal <vlad@prokk.net>2020-05-14 10:54:23 +0300
committerGitHub <noreply@github.com>2020-05-14 10:54:23 +0300
commitb5f8c224a9636c071fc474634380b4a93ea21c28 (patch)
tree0676b067283d6c1fe46f091a7bba6afc6a362bc3 /CMakeLists.txt
parentb8fce8d15bd9f97e8748305ca8f839a6de889199 (diff)
Add a Google Cloud Pub/Sub connector to the exporting engine (#8855)
* Implement formatters * Add specific configuration options * Add the connector to the Autotools and CMake configuration * Initialize a connector instance * Publish netdata metrics * Fix internal stats * Add unit tests * Improve the documentation
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt57
1 files changed, 56 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e14e99ecbe..d97ae1d11f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -252,6 +252,23 @@ find_library(HAVE_KINESIS aws-cpp-sdk-kinesis)
# later we use:
# ${HAVE_KINESIS}
+# -----------------------------------------------------------------------------
+# Detect libgrpc
+
+pkg_check_modules(GRPC grpc)
+# later we use:
+# ${GRPCF_LIBRARIES}
+# ${GRPC_CFLAGS_OTHER}
+# ${GRPC_INCLUDE_DIRS}
+
+# -----------------------------------------------------------------------------
+# Detect libgoogleapis_cpp_pubsub_protos
+
+pkg_check_modules(PUBSUB googleapis_cpp_pubsub_protos)
+# later we use:
+# ${PUBSUB_LIBRARIES}
+# ${PUBSUB_CFLAGS_OTHER}
+# ${PUBSUB_INCLUDE_DIRS}
# -----------------------------------------------------------------------------
# Detect libprotobuf
@@ -662,6 +679,13 @@ set(KINESIS_EXPORTING_FILES
exporting/aws_kinesis/aws_kinesis_put_record.h
)
+set(PUBSUB_EXPORTING_FILES
+ exporting/pubsub/pubsub.c
+ exporting/pubsub/pubsub.h
+ exporting/pubsub/pubsub_publish.cc
+ exporting/pubsub/pubsub_publish.h
+ )
+
set(MONGODB_EXPORTING_FILES
exporting/mongodb/mongodb.c
exporting/mongodb/mongodb.h
@@ -759,6 +783,25 @@ ELSE()
ENDIF()
# -----------------------------------------------------------------------------
+# Pub/Sub exporting connector
+
+IF(GRPC_LIBRARIES AND PUBSUB_LIBRARIES)
+ SET(ENABLE_EXPORTING_PUBSUB True)
+ELSE()
+ SET(ENABLE_EXPORTING_PUBSUB False)
+ENDIF()
+
+IF(ENABLE_EXPORTING_PUBSUB)
+ message(STATUS "pubsub exporting connector: enabled")
+ list(APPEND NETDATA_FILES ${PUBSUB_EXPORTING_FILES})
+ list(APPEND NETDATA_COMMON_LIBRARIES ${GRPC_LIBRARIES} ${PUBSUB_LIBRARIES})
+ list(APPEND NETDATA_COMMON_INCLUDE_DIRS ${GRPC_INCLUDE_DIRS} ${PUBSUB_INCLUDE_DIRS})
+ list(APPEND NETDATA_COMMON_CFLAGS ${GRPC_CFLAGS_OTHER} ${PUBSUB_CFLAGS_OTHER})
+ELSE()
+ message(STATUS "pubsub exporting connector: disabled (requires grpc and googleapis)")
+ENDIF()
+
+# -----------------------------------------------------------------------------
# prometheus remote write backend
IF(PROTOBUF_LIBRARIES AND SNAPPY_LIBRARIES)
@@ -867,7 +910,7 @@ ELSEIF(MACOS)
ENDIF()
-IF(ENABLE_BACKEND_KINESIS OR ENABLE_BACKEND_PROMETHEUS_REMOTE_WRITE)
+IF(ENABLE_BACKEND_KINESIS OR ENABLE_EXPORTING_PUBSUB OR ENABLE_BACKEND_PROMETHEUS_REMOTE_WRITE)
set_property(TARGET netdata PROPERTY CXX_STANDARD 11)
set_property(TARGET netdata PROPERTY CMAKE_CXX_STANDARD_REQUIRED ON)
ENDIF()
@@ -1040,6 +1083,7 @@ if(BUILD_TESTING)
set(TEST_NAME exporting_engine)
set(PROMETHEUS_REMOTE_WRITE_LINK_OPTIONS)
set(KINESIS_LINK_OPTIONS)
+ set(PUBSUB_LINK_OPTIONS)
set(MONGODB_LINK_OPTIONS)
if(ENABLE_BACKEND_PROMETHEUS_REMOTE_WRITE)
list(APPEND EXPORTING_ENGINE_FILES ${PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES} ${PROTO_SRCS} ${PROTO_HDRS})
@@ -1061,6 +1105,16 @@ if(ENABLE_BACKEND_KINESIS)
-Wl,--wrap=kinesis_get_result
)
endif()
+if(ENABLE_EXPORTING_PUBSUB)
+ list(APPEND EXPORTING_ENGINE_FILES ${PUBSUB_EXPORTING_FILES})
+ list(
+ APPEND PUBSUB_LINK_OPTIONS
+ -Wl,--wrap=pubsub_init
+ -Wl,--wrap=pubsub_add_message
+ -Wl,--wrap=pubsub_publish
+ -Wl,--wrap=pubsub_get_result
+ )
+endif()
if(MONGOC_LIBRARIES)
list(APPEND EXPORTING_ENGINE_FILES ${MONGODB_EXPORTING_FILES})
list(
@@ -1116,6 +1170,7 @@ endif()
-Wl,--wrap=send_main_rusage
${PROMETHEUS_REMOTE_WRITE_LINK_OPTIONS}
${KINESIS_LINK_OPTIONS}
+ ${PUBSUB_LINK_OPTIONS}
${MONGODB_LINK_OPTIONS}
)
target_link_libraries(${TEST_NAME}_testdriver libnetdata ${NETDATA_COMMON_LIBRARIES} ${CMOCKA_LIBRARIES})