Make histograms atomic

E.g. count and sum should be consistent with each other
This commit is contained in:
2025-08-29 21:05:51 -04:00
parent 50e27cced8
commit 935bab9454
2 changed files with 75 additions and 104 deletions

View File

@@ -25,7 +25,7 @@ struct ContentionEnvironment {
metric::Family<metric::Counter> counter_family =
metric::create_counter("counter", "");
metric::Family<metric::Histogram> histogram_family = metric::create_histogram(
"histogram", "", metric::exponential_buckets(0.001, 5, 7));
"histogram", "", metric::exponential_buckets(0.001, 5, 8));
ContentionEnvironment() = default;
@@ -99,7 +99,7 @@ int main() {
metric::Family<metric::Counter> counter_family =
metric::create_counter("counter", "");
metric::Family<metric::Histogram> histogram_family = metric::create_histogram(
"histogram", "", metric::exponential_buckets(0.001, 5, 7));
"histogram", "", metric::exponential_buckets(0.001, 5, 8));
auto counter = counter_family.create({});
auto gauge = gauge_family.create({});
@@ -176,7 +176,8 @@ int main() {
auto gauge_family = metric::create_gauge("scale_gauge", "Scale gauge");
auto histogram_family = metric::create_histogram(
"scale_histogram", "Scale histogram",
std::initializer_list<double>{0.1, 0.5, 1.0, 2.5, 5.0, 10.0, 25.0});
std::initializer_list<double>{0.1, 0.5, 1.0, 2.5, 5.0, 10.0, 25.0,
50.0});
// Create varying numbers of metrics
for (int scale : {10, 100, 1000}) {