@@ -28,14 +28,15 @@ var (
28
28
type Exporter struct {
29
29
URI string
30
30
mutex sync.RWMutex
31
- up , slotsTotal , slotsFree prometheus.Gauge
31
+ up , slotsTotal , slotsFree , newSessionRequestCount prometheus.Gauge
32
32
}
33
33
34
34
type hubResponse struct {
35
35
Success bool `json:"success"`
36
36
Debug bool `json:"debug"`
37
37
CleanUpCycle int `json:"cleanUpCycle"`
38
38
Slots slotCounts `json:"slotCounts"`
39
+ NewSession float64 `json:"newSessionRequestCount"`
39
40
}
40
41
41
42
type slotCounts struct {
@@ -65,13 +66,20 @@ func NewExporter(uri string) *Exporter {
65
66
Name : "slotsFree" ,
66
67
Help : "number of free slots" ,
67
68
}),
69
+ newSessionRequestCount : prometheus .NewGauge (prometheus.GaugeOpts {
70
+ Namespace : nameSpace ,
71
+ Subsystem : subSystem ,
72
+ Name : "sessions_backlog" ,
73
+ Help : "number of sessions waiting for a slot" ,
74
+ }),
68
75
}
69
76
}
70
77
71
78
func (e * Exporter ) Describe (ch chan <- * prometheus.Desc ) {
72
79
e .up .Describe (ch )
73
80
e .slotsTotal .Describe (ch )
74
81
e .slotsFree .Describe (ch )
82
+ e .newSessionRequestCount .Describe (ch )
75
83
}
76
84
77
85
func (e * Exporter ) Collect (ch chan <- prometheus.Metric ) {
@@ -84,6 +92,7 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
84
92
ch <- e .up
85
93
ch <- e .slotsTotal
86
94
ch <- e .slotsFree
95
+ ch <- e .newSessionRequestCount
87
96
88
97
return
89
98
}
@@ -109,9 +118,10 @@ func (e *Exporter) scrape() {
109
118
log .Errorf ("Can't decode Selenium Grid response: %v" , err )
110
119
return
111
120
}
112
-
121
+
113
122
e .slotsTotal .Set (hResponse .Slots .Total )
114
123
e .slotsFree .Set (hResponse .Slots .Free )
124
+ e .newSessionRequestCount .Set (hResponse .NewSession )
115
125
116
126
}
117
127
0 commit comments