From fd13318ca86bc83cfe7749822b5eda6fabb1a181 Mon Sep 17 00:00:00 2001 From: medina5 Date: Fri, 5 Dec 2025 17:25:27 +0100 Subject: [PATCH] histo --- tp2.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tp2.md b/tp2.md index 9e926af..29a1718 100644 --- a/tp2.md +++ b/tp2.md @@ -183,3 +183,23 @@ Ajouter un histogramme pour le volume dans le réservoir - 8 - 9 - 9.5 + +``` +#include + + + Histogram::BucketBoundaries buckets = { + 2, 5, 6, 7, 8, 9, 9.5 + }; + + auto& hist_family = BuildHistogram() + .Name("volume") + .Help("volume du reservoir en m3") + .Register(*registry); + +auto& request_volume = hist_family.Add({}, buckets); + +auto& request_duration_login = + hist_family.Add({{"endpoint", "/login"}}, buckets); + +request_duration_login.Observe(0.42);