summaryrefslogtreecommitdiffstats
path: root/backends
diff options
context:
space:
mode:
authorVladimir Kobal <vlad@prokk.net>2020-01-07 17:34:13 +0200
committerGitHub <noreply@github.com>2020-01-07 17:34:13 +0200
commitfdf3a801df2f2a059adb0f3fb57df62468302fa0 (patch)
treee08671d09f1793b21cae2f08dd86baad58571a79 /backends
parent42a72f61dbd6f66bc9cf9fa9e273cc47d466491b (diff)
Restore support for protobuf 3.0 (#7683)
Diffstat (limited to 'backends')
-rw-r--r--backends/prometheus/remote_write/remote_write.cc4
1 files changed, 4 insertions, 0 deletions
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;
}