Add compression and histogram metric type for Prometheus (#987)

Fixes #932
Also fixes #966

Decided not to add Summary type because it has the same functionality as Histogram but makes more calculations on client side (Clio side). See https://prometheus.io/docs/practices/histograms for detailed comparison.
This commit is contained in:
Sergey Kuznetsov
2023-11-22 12:55:06 +00:00
committed by GitHub
parent 8ebe2d6a80
commit b998473673
41 changed files with 2230 additions and 619 deletions

View File

@@ -19,6 +19,7 @@
#include <util/prometheus/Counter.h>
#include <boost/iostreams/device/back_inserter.hpp>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -53,9 +54,9 @@ TEST_F(AnyCounterTests, labelsString)
TEST_F(AnyCounterTests, serialize)
{
EXPECT_CALL(mockCounterImpl, value()).WillOnce(::testing::Return(42));
std::string serialized;
counter.serialize(serialized);
EXPECT_EQ(serialized, R"(test_counter{label1="value1",label2="value2"} 42)");
OStream stream{false};
counter.serializeValue(stream);
EXPECT_EQ(std::move(stream).data(), R"(test_counter{label1="value1",label2="value2"} 42)");
}
TEST_F(AnyCounterTests, operatorAdd)