@@ -6,9 +6,10 @@ import (
6
6
7
7
// metrics is the struct that contains pointers to our metric containers.
8
8
type metrics struct {
9
- bodyBytes * prometheus.HistogramVec
10
- upstreamSeconds * prometheus.HistogramVec
11
- requestSeconds * prometheus.HistogramVec
9
+ bodyBytes * prometheus.HistogramVec
10
+ upstreamHeaderSeconds * prometheus.HistogramVec
11
+ upstreamSeconds * prometheus.HistogramVec
12
+ requestSeconds * prometheus.HistogramVec
12
13
}
13
14
14
15
// newMetrics creates a new metrics based on the provided application and
@@ -35,11 +36,19 @@ func newMetrics(application string, labelNames []string) *metrics {
35
36
ConstLabels : prometheus.Labels {"application" : application },
36
37
}, labelNames )
37
38
38
- prometheus .MustRegister (bodyBytes , upstreamSeconds , requestSeconds )
39
+ upstreamHeaderSeconds := prometheus .NewHistogramVec (prometheus.HistogramOpts {
40
+ Namespace : "nginx" ,
41
+ Name : "http_upstream_header_time_seconds" ,
42
+ Help : "Time to receiving the first byte of the response header from upstream servers" ,
43
+ ConstLabels : prometheus.Labels {"application" : application },
44
+ }, labelNames )
45
+
46
+ prometheus .MustRegister (bodyBytes , upstreamHeaderSeconds , upstreamSeconds , requestSeconds )
39
47
40
48
return & metrics {
41
- bodyBytes : bodyBytes ,
42
- requestSeconds : requestSeconds ,
43
- upstreamSeconds : upstreamSeconds ,
49
+ bodyBytes : bodyBytes ,
50
+ requestSeconds : requestSeconds ,
51
+ upstreamSeconds : upstreamSeconds ,
52
+ upstreamHeaderSeconds : upstreamHeaderSeconds ,
44
53
}
45
54
}
0 commit comments