From fdf3a801df2f2a059adb0f3fb57df62468302fa0 Mon Sep 17 00:00:00 2001 From: Vladimir Kobal Date: Tue, 7 Jan 2020 17:34:13 +0200 Subject: Restore support for protobuf 3.0 (#7683) --- CMakeLists.txt | 2 +- backends/prometheus/remote_write/remote_write.cc | 4 ++++ configure.ac | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 67a4841d69..a78b74e6dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -256,7 +256,7 @@ find_library(HAVE_KINESIS aws-cpp-sdk-kinesis) # ----------------------------------------------------------------------------- # Detect libprotobuf -pkg_check_modules(PROTOBUF protobuf>=3.1) +pkg_check_modules(PROTOBUF protobuf>=3) # later we use: # ${PROTOBUF_LIBRARIES} # ${PROTOBUF_CFLAGS_OTHER} diff --git a/backends/prometheus/remote_write/remote_write.cc b/backends/prometheus/remote_write/remote_write.cc index aacfb10cf4..8246feefa6 100644 --- a/backends/prometheus/remote_write/remote_write.cc +++ b/backends/prometheus/remote_write/remote_write.cc @@ -98,7 +98,11 @@ void add_metric(const char *name, const char *chart, const char *family, const c } size_t get_write_request_size(){ +#if GOOGLE_PROTOBUF_VERSION < 3001000 + size_t size = (size_t)snappy::MaxCompressedLength(write_request->ByteSize()); +#else size_t size = (size_t)snappy::MaxCompressedLength(write_request->ByteSizeLong()); +#endif return (size < INT_MAX)?size:0; } diff --git a/configure.ac b/configure.ac index 8b2facb966..356ab447c7 100644 --- a/configure.ac +++ b/configure.ac @@ -932,7 +932,7 @@ AM_CONDITIONAL([ENABLE_BACKEND_KINESIS], [test "${enable_backend_kinesis}" = "ye PKG_CHECK_MODULES( [PROTOBUF], - [protobuf >= 3.1], + [protobuf >= 3], [have_libprotobuf=yes], [have_libprotobuf=no] ) -- cgit v1.2.3