@@ -15,24 +15,21 @@ type prometheusExporter struct {
15
15
var (
16
16
metrics = prometheusExporter {}
17
17
18
- sshConnEstablishedDesc = prometheus .NewDesc ("sshproxy_connections_established" , "Established SSH connections" , nil , nil )
19
- sshConnFailedDesc = prometheus .NewDesc ("sshproxy_connections_failed" , "Failed SSH connections" , nil , nil )
20
- sshForwardEstablishedDesc = prometheus .NewDesc ("sshproxy_forwardings_established" , "Established SSH forwardings" , nil , nil )
21
- sshForwardFailedDesc = prometheus .NewDesc ("sshproxy_forwardings_failed" , "Failed SSH forwardings" , nil , nil )
18
+ variableLabels = []string {"state" }
19
+ sshConnectionsDesc = prometheus .NewDesc ("sshproxy_connections_total" , "SSH connections" , variableLabels , nil )
20
+ sshForwardingsDesc = prometheus .NewDesc ("sshproxy_forwardings_total" , "TCP forwardings" , variableLabels , nil )
22
21
)
23
22
24
23
// Describe implements (part of the) prometheus.Collector interface.
25
24
func (e * prometheusExporter ) Describe (c chan <- * prometheus.Desc ) {
26
- c <- sshConnEstablishedDesc
27
- c <- sshConnFailedDesc
28
- c <- sshForwardEstablishedDesc
29
- c <- sshForwardFailedDesc
25
+ c <- sshConnectionsDesc
26
+ c <- sshForwardingsDesc
30
27
}
31
28
32
29
// Collect implements (part of the) prometheus.Collector interface.
33
30
func (e prometheusExporter ) Collect (c chan <- prometheus.Metric ) {
34
- c <- prometheus .MustNewConstMetric (sshConnEstablishedDesc , prometheus .CounterValue , float64 (e .connections .established ))
35
- c <- prometheus .MustNewConstMetric (sshConnFailedDesc , prometheus .CounterValue , float64 (e .connections .failed ))
36
- c <- prometheus .MustNewConstMetric (sshForwardEstablishedDesc , prometheus .CounterValue , float64 (e .forwardings .established ))
37
- c <- prometheus .MustNewConstMetric (sshForwardFailedDesc , prometheus .CounterValue , float64 (e .forwardings .failed ))
31
+ c <- prometheus .MustNewConstMetric (sshConnectionsDesc , prometheus .CounterValue , float64 (e .connections .established ), "established" )
32
+ c <- prometheus .MustNewConstMetric (sshConnectionsDesc , prometheus .CounterValue , float64 (e .connections .failed ), "failed" )
33
+ c <- prometheus .MustNewConstMetric (sshForwardingsDesc , prometheus .CounterValue , float64 (e .forwardings .established ), "established" )
34
+ c <- prometheus .MustNewConstMetric (sshForwardingsDesc , prometheus .CounterValue , float64 (e .forwardings .failed ), "failed" )
38
35
}
0 commit comments