@@ -14,32 +14,36 @@ type metrics struct {
14
14
15
15
// newMetrics creates a new metrics based on the provided application and
16
16
// label names.
17
- func newMetrics (application string , labelNames []string ) * metrics {
17
+ func newMetrics (application string , labelNames []string , histogramBuckets [] float64 ) * metrics {
18
18
bodyBytes := prometheus .NewHistogramVec (prometheus.HistogramOpts {
19
19
Namespace : "nginx" ,
20
20
Name : "http_body_bytes_sent" ,
21
21
Help : "Number of body bytes sent to the client" ,
22
+ Buckets : histogramBuckets ,
22
23
ConstLabels : prometheus.Labels {"application" : application },
23
24
}, labelNames )
24
25
25
26
requestSeconds := prometheus .NewHistogramVec (prometheus.HistogramOpts {
26
27
Namespace : "nginx" ,
27
28
Name : "http_request_time_seconds" ,
28
29
Help : "Time spent on processing HTTP requests" ,
30
+ Buckets : histogramBuckets ,
29
31
ConstLabels : prometheus.Labels {"application" : application },
30
32
}, labelNames )
31
33
32
34
upstreamSeconds := prometheus .NewHistogramVec (prometheus.HistogramOpts {
33
35
Namespace : "nginx" ,
34
36
Name : "http_upstream_response_time_seconds" ,
35
37
Help : "Time spent on receiving a response from upstream servers" ,
38
+ Buckets : histogramBuckets ,
36
39
ConstLabels : prometheus.Labels {"application" : application },
37
40
}, labelNames )
38
41
39
42
upstreamHeaderSeconds := prometheus .NewHistogramVec (prometheus.HistogramOpts {
40
43
Namespace : "nginx" ,
41
44
Name : "http_upstream_header_time_seconds" ,
42
45
Help : "Time to receiving the first byte of the response header from upstream servers" ,
46
+ Buckets : histogramBuckets ,
43
47
ConstLabels : prometheus.Labels {"application" : application },
44
48
}, labelNames )
45
49
0 commit comments