@@ -22,10 +22,38 @@ func requestsFailure(ctx context.Context) imetrics.Counter {
22
22
return imetrics .NewCtx (ctx , "requests_failure" , "Failed (no response, dial error etc) requests count" ).Counter ()
23
23
}
24
24
25
+ func requestSentBytes (ctx context.Context ) imetrics.Counter {
26
+ return imetrics .NewCtx (ctx , "request_sent_bytes" , "Total bytes sent on requests" ).Counter ()
27
+ }
28
+
29
+ func requestTime (ctx context.Context ) imetrics.Histogram {
30
+ return imetrics .NewCtx (ctx , "request_duration_seconds" , "Histogram of request durations" ).Histogram (durationHistogramBuckets )
31
+ }
32
+
25
33
func requestsBodyFailure (ctx context.Context ) imetrics.Counter {
26
34
return imetrics .NewCtx (ctx , "requests_body_failure" , "Failure count when reading response body" ).Counter ()
27
35
}
28
36
37
+ func responseSizes (ctx context.Context ) imetrics.Histogram {
38
+ return imetrics .NewCtx (ctx , "response_bytes" , "Histogram of http response sizes" ).Histogram (blockSizesHistogramBuckets )
39
+ }
40
+
41
+ func responseTotalBytes (ctx context.Context ) imetrics.Counter {
42
+ return imetrics .NewCtx (ctx , "response_total_bytes" , "Accumulated response bytes" ).Counter ()
43
+ }
44
+
45
+ func wantlistsTotal (ctx context.Context ) imetrics.Counter {
46
+ return imetrics .NewCtx (ctx , "wantlists_total" , "Total number of wantlists sent" ).Counter ()
47
+ }
48
+
49
+ func wantlistsItemsTotal (ctx context.Context ) imetrics.Counter {
50
+ return imetrics .NewCtx (ctx , "wantlists_items_total" , "Total number of elements in sent wantlists" ).Counter ()
51
+ }
52
+
53
+ func wantlistsSeconds (ctx context.Context ) imetrics.Counter {
54
+ return imetrics .NewCtx (ctx , "wantlists_seconds" , "Number of seconds spent sending wantlists" ).Counter ()
55
+ }
56
+
29
57
func statusNotFound (ctx context.Context ) imetrics.Counter {
30
58
return imetrics .NewCtx (ctx , "status_404" , "Request count with NotFound status" ).Counter ()
31
59
}
@@ -62,18 +90,16 @@ func statusOthers(ctx context.Context) imetrics.Counter {
62
90
return imetrics .NewCtx (ctx , "status_others" , "Request count with other status codes" ).Counter ()
63
91
}
64
92
65
- func requestTime (ctx context.Context ) imetrics.Histogram {
66
- return imetrics .NewCtx (ctx , "request_duration_seconds" , "Histogram of request durations" ).Histogram (durationHistogramBuckets )
67
- }
68
-
69
- func responseSize (ctx context.Context ) imetrics.Histogram {
70
- return imetrics .NewCtx (ctx , "response_bytes" , "Histogram of http response sizes" ).Histogram (blockSizesHistogramBuckets )
71
- }
72
-
73
93
type metrics struct {
74
94
RequestsInFlight imetrics.Gauge
75
95
RequestsTotal imetrics.Counter
76
96
RequestsFailure imetrics.Counter
97
+ RequestsSentBytes imetrics.Counter
98
+ WantlistsTotal imetrics.Counter
99
+ WantlistsItemsTotal imetrics.Counter
100
+ WantlistsSeconds imetrics.Counter
101
+ ResponseSizes imetrics.Histogram
102
+ ResponseTotalBytes imetrics.Counter
77
103
RequestsBodyFailure imetrics.Counter
78
104
StatusNotFound imetrics.Counter
79
105
StatusGone imetrics.Counter
@@ -85,7 +111,6 @@ type metrics struct {
85
111
StatusInternalServerError imetrics.Counter
86
112
StatusOthers imetrics.Counter
87
113
RequestTime imetrics.Histogram
88
- ResponseSize imetrics.Histogram
89
114
}
90
115
91
116
func newMetrics () * metrics {
@@ -94,8 +119,14 @@ func newMetrics() *metrics {
94
119
return & metrics {
95
120
RequestsInFlight : requestsInFlight (ctx ),
96
121
RequestsTotal : requestsTotal (ctx ),
122
+ RequestsSentBytes : requestSentBytes (ctx ),
97
123
RequestsFailure : requestsFailure (ctx ),
98
124
RequestsBodyFailure : requestsBodyFailure (ctx ),
125
+ WantlistsTotal : wantlistsTotal (ctx ),
126
+ WantlistsItemsTotal : wantlistsItemsTotal (ctx ),
127
+ WantlistsSeconds : wantlistsSeconds (ctx ),
128
+ ResponseSizes : responseSizes (ctx ),
129
+ ResponseTotalBytes : responseTotalBytes (ctx ),
99
130
StatusNotFound : statusNotFound (ctx ),
100
131
StatusGone : statusGone (ctx ),
101
132
StatusForbidden : statusForbidden (ctx ),
@@ -106,7 +137,6 @@ func newMetrics() *metrics {
106
137
StatusInternalServerError : statusInternalServerError (ctx ),
107
138
StatusOthers : statusOthers (ctx ),
108
139
RequestTime : requestTime (ctx ),
109
- ResponseSize : responseSize (ctx ),
110
140
}
111
141
}
112
142
0 commit comments