This commit is contained in:
2025-12-09 13:47:29 +01:00
parent 22fd230777
commit ac3f8e1750
2 changed files with 95 additions and 12 deletions

22
tp2.md
View File

@@ -184,22 +184,20 @@ Ajouter un histogramme pour le volume dans le réservoir
- 9
- 9.5
```
```c
#include <prometheus/histogram.h>
Histogram::BucketBoundaries buckets = {
2, 5, 6, 7, 8, 9, 9.5
};
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& 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);
request_volume.Observe(0.42);
```