Exemplo n.º 1
0
func ConnStateMetrics(g prometheus.Gauge) ConnStateFunc {
	return func(c net.Conn, s http.ConnState) {
		switch s {
		case http.StateNew:
			g.Inc()
		case http.StateClosed:
			g.Dec()
		}
	}
}
func readGauge(m prometheus.Gauge) float64 {
	// TODO: Revisit this once client_golang offers better testing tools.
	pb := &dto.Metric{}
	m.Write(pb)
	return pb.GetGauge().GetValue()
}