We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2027424 commit 1a3167aCopy full SHA for 1a3167a
tests/histogram_test.cc
@@ -76,3 +76,15 @@ TEST_F(HistogramTest, bucket_bounds) {
76
EXPECT_EQ(h.bucket(1).upper_bound(), 2);
77
EXPECT_EQ(h.bucket(2).upper_bound(), std::numeric_limits<double>::infinity());
78
}
79
+
80
+TEST_F(HistogramTest, cumulative_bucket_counts_not_reset_by_collection) {
81
+ Histogram histogram{{1, 2}};
82
+ histogram.Observe(1.5);
83
+ histogram.Collect();
84
85
+ auto metric = histogram.Collect();
86
+ ASSERT_TRUE(metric.has_histogram());
87
+ auto h = metric.histogram();
88
+ ASSERT_EQ(h.bucket_size(), 3);
89
+ EXPECT_EQ(h.bucket(1).cumulative_count(), 2);
90
+}
0 commit comments