@@ -53,12 +53,28 @@ var (
53
53
Buckets : []float64 {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 },
54
54
})
55
55
56
+ numberOfIngredientsPerPizzaNativeHistogram = promauto .NewHistogram (prometheus.HistogramOpts {
57
+ Name : "number_of_ingredients_per_pizza_alternate" ,
58
+ Help : "The number of ingredients per pizza (Native Histogram)" ,
59
+ NativeHistogramBucketFactor : 1.1 ,
60
+ NativeHistogramMaxBucketNumber : 100 ,
61
+ NativeHistogramMinResetDuration : 1 * time .Hour ,
62
+ })
63
+
56
64
pizzaCaloriesPerSlice = promauto .NewHistogram (prometheus.HistogramOpts {
57
65
Name : "pizza_calories_per_slice" ,
58
66
Help : "The number of calories per slice of pizza" ,
59
67
Buckets : []float64 {100 , 200 , 300 , 400 , 500 , 600 , 700 , 800 , 900 , 1000 , 1100 , 1200 , 1300 , 1400 , 1500 , 1600 , 1700 , 1800 , 1900 , 2000 },
60
68
})
61
69
70
+ pizzaCaloriesPerSliceNativeHistogram = promauto .NewHistogram (prometheus.HistogramOpts {
71
+ Name : "pizza_calories_per_slice_alternate" ,
72
+ Help : "The number of calories per slice of pizza (Native Histogram)" ,
73
+ NativeHistogramBucketFactor : 1.1 ,
74
+ NativeHistogramMaxBucketNumber : 100 ,
75
+ NativeHistogramMinResetDuration : 1 * time .Hour ,
76
+ })
77
+
62
78
httpRequests = promauto .NewCounterVec (prometheus.CounterOpts {
63
79
Name : "http_requests_total" ,
64
80
Help : "The total number of HTTP requests" ,
@@ -699,7 +715,9 @@ func (s *Server) WithRecommendations(catalogClient CatalogClient, copyClient Cop
699
715
}).Inc ()
700
716
701
717
numberOfIngredientsPerPizza .Observe (float64 (len (p .Ingredients )))
718
+ numberOfIngredientsPerPizzaNativeHistogram .Observe (float64 (len (p .Ingredients )))
702
719
pizzaCaloriesPerSlice .Observe (float64 (pizzaRecommendation .Calories ))
720
+ pizzaCaloriesPerSliceNativeHistogram .Observe (float64 (pizzaRecommendation .Calories ))
703
721
704
722
s .log .InfoContext (r .Context (), "New pizza recommendation" , "pizza" , pizzaRecommendation .Pizza .Name )
705
723
0 commit comments