Restore support for protobuf 3.0 (#7683)
Vladimir Kobal committed
Jan 7, 2020 at 17:34 UTC
fdf3a801df2f2a059adb0f3fb57df62468302fa0
3 files changed
+6
-2
CMakeLists.txt
+1
-1
@@ -256,7 +256,7 @@ find_library(HAVE_KINESIS aws-cpp-sdk-kinesis)
256
# -----------------------------------------------------------------------------
257
# Detect libprotobuf
258
259
-pkg_check_modules(PROTOBUF protobuf>=3.1)
259
+pkg_check_modules(PROTOBUF protobuf>=3)
260
# later we use:
261
# ${PROTOBUF_LIBRARIES}
262
# ${PROTOBUF_CFLAGS_OTHER}
backends/prometheus/remote_write/remote_write.cc
+4
@@ -98,7 +98,11 @@ void add_metric(const char *name, const char *chart, const char *family, const c
98
}
99
100
size_t get_write_request_size(){
101
+#if GOOGLE_PROTOBUF_VERSION < 3001000
102
+ size_t size = (size_t)snappy::MaxCompressedLength(write_request->ByteSize());
103
+#else
104
size_t size = (size_t)snappy::MaxCompressedLength(write_request->ByteSizeLong());
105
+#endif
106
107
return (size < INT_MAX)?size:0;
108
}
configure.ac
+1
-1
@@ -932,7 +932,7 @@ AM_CONDITIONAL([ENABLE_BACKEND_KINESIS], [test "${enable_backend_kinesis}" = "ye
932
933
PKG_CHECK_MODULES(
934
[PROTOBUF],
935
- [protobuf >= 3.1],
935
+ [protobuf >= 3],
936
[have_libprotobuf=yes],
937
[have_libprotobuf=no]
938
)