@@ -28,7 +28,8 @@ const (
28
28
// HAProxy 1.4
29
29
// # pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,
30
30
// HAProxy 1.5
31
- // pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,comp_in,comp_out,comp_byp,comp_rsp,lastsess,
31
+ // These columns are part of the stable API for HAProxy and are documented here: https://cbonte.github.io/haproxy-dconv/1.5/configuration.html#9.1
32
+ // pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,comp_in,comp_out,comp_byp,comp_rsp,lastsess,last_chk,last_agt,qtime,ctime,rtime,ttime
32
33
expectedCsvFieldCount = 52
33
34
statusField = 17
34
35
@@ -91,8 +92,9 @@ func (m metrics) Names() []int {
91
92
return keys
92
93
}
93
94
94
- // defaultSelectedMetrics is the list of metrics included by default
95
- var defaultSelectedMetrics = []int {2 , 4 , 5 , 7 , 8 , 9 , 13 , 14 , 17 , 21 , 24 , 33 , 35 , 40 , 43 }
95
+ // defaultSelectedMetrics is the list of metrics included by default. These metrics are a subset
96
+ // of the metrics exposed by haproxy_exporter by default for performance reasons.
97
+ var defaultSelectedMetrics = []int {2 , 4 , 5 , 7 , 8 , 9 , 13 , 14 , 17 , 21 , 24 , 33 , 35 , 40 , 43 , 60 }
96
98
97
99
// Exporter collects HAProxy stats from the given URI and exports them using
98
100
// the prometheus metrics package.
@@ -194,6 +196,7 @@ func NewExporter(opts PrometheusOptions) (*Exporter, error) {
194
196
43 : newFrontendMetric ("http_responses_total" , "Total of HTTP responses." , prometheus.Labels {"code" : "5xx" }),
195
197
44 : newFrontendMetric ("http_responses_total" , "Total of HTTP responses." , prometheus.Labels {"code" : "other" }),
196
198
48 : newFrontendMetric ("http_requests_total" , "Total HTTP requests." , nil ),
199
+ 60 : newFrontendMetric ("http_average_response_latency_milliseconds" , "Average response latency of the last 1024 requests in milliseconds." , nil ),
197
200
}),
198
201
reducedBackendExports : map [int ]struct {}{2 : {}, 3 : {}, 7 : {}, 17 : {}},
199
202
backendMetrics : filterMetrics (opts .ExportedMetrics , metrics {
@@ -219,6 +222,7 @@ func NewExporter(opts PrometheusOptions) (*Exporter, error) {
219
222
42 : newBackendMetric ("http_responses_total" , "Total of HTTP responses." , prometheus.Labels {"code" : "4xx" }),
220
223
43 : newBackendMetric ("http_responses_total" , "Total of HTTP responses." , prometheus.Labels {"code" : "5xx" }),
221
224
44 : newBackendMetric ("http_responses_total" , "Total of HTTP responses." , prometheus.Labels {"code" : "other" }),
225
+ 60 : newBackendMetric ("http_average_response_latency_milliseconds" , "Average response latency of the last 1024 requests in milliseconds." , nil ),
222
226
}),
223
227
serverMetrics : filterMetrics (opts .ExportedMetrics , metrics {
224
228
2 : newServerMetric ("current_queue" , "Current number of queued requests assigned to this server." , nil ),
@@ -246,6 +250,7 @@ func NewExporter(opts PrometheusOptions) (*Exporter, error) {
246
250
42 : newServerMetric ("http_responses_total" , "Total of HTTP responses." , prometheus.Labels {"code" : "4xx" }),
247
251
43 : newServerMetric ("http_responses_total" , "Total of HTTP responses." , prometheus.Labels {"code" : "5xx" }),
248
252
44 : newServerMetric ("http_responses_total" , "Total of HTTP responses." , prometheus.Labels {"code" : "other" }),
253
+ 60 : newServerMetric ("http_average_response_latency_milliseconds" , "Average response latency of the last 1024 requests in milliseconds." , nil ),
249
254
}),
250
255
}, nil
251
256
}
0 commit comments