mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-22 16:34:32 +01:00
796c5ad42d
transport/ssh: update go-netssh to new version => supports CloseWrite and Deadlines => build: require Go 1.11 (netssh requires it)
64 lines
2.1 KiB
Go
64 lines
2.1 KiB
Go
package frameconn
|
|
|
|
import "github.com/prometheus/client_golang/prometheus"
|
|
|
|
var prom struct {
|
|
ShutdownDrainBytesRead prometheus.Summary
|
|
ShutdownSeconds prometheus.Summary
|
|
ShutdownDrainSeconds prometheus.Summary
|
|
ShutdownHardCloses *prometheus.CounterVec
|
|
ShutdownCloseErrors *prometheus.CounterVec
|
|
}
|
|
|
|
func init() {
|
|
prom.ShutdownDrainBytesRead = prometheus.NewSummary(prometheus.SummaryOpts{
|
|
Namespace: "zrepl",
|
|
Subsystem: "frameconn",
|
|
Name: "shutdown_drain_bytes_read",
|
|
Help: "Number of bytes read during the drain phase of connection shutdown",
|
|
})
|
|
prom.ShutdownSeconds = prometheus.NewSummary(prometheus.SummaryOpts{
|
|
Namespace: "zrepl",
|
|
Subsystem: "frameconn",
|
|
Name: "shutdown_seconds",
|
|
Help: "Seconds it took for connection shutdown to complete",
|
|
})
|
|
prom.ShutdownDrainSeconds = prometheus.NewSummary(prometheus.SummaryOpts{
|
|
Namespace: "zrepl",
|
|
Subsystem: "frameconn",
|
|
Name: "shutdown_drain_seconds",
|
|
Help: "Seconds it took from read-side-drain until shutdown completion",
|
|
})
|
|
prom.ShutdownHardCloses = prometheus.NewCounterVec(prometheus.CounterOpts{
|
|
Namespace: "zrepl",
|
|
Subsystem: "frameconn",
|
|
Name: "shutdown_hard_closes",
|
|
Help: "Number of hard connection closes during shutdown (abortive close)",
|
|
}, []string{"step"})
|
|
prom.ShutdownCloseErrors = prometheus.NewCounterVec(prometheus.CounterOpts{
|
|
Namespace: "zrepl",
|
|
Subsystem: "frameconn",
|
|
Name: "shutdown_close_errors",
|
|
Help: "Number of errors closing the underlying network connection. Should alert on this",
|
|
}, []string{"step"})
|
|
}
|
|
|
|
func PrometheusRegister(registry prometheus.Registerer) error {
|
|
if err := registry.Register(prom.ShutdownDrainBytesRead); err != nil {
|
|
return err
|
|
}
|
|
if err := registry.Register(prom.ShutdownSeconds); err != nil {
|
|
return err
|
|
}
|
|
if err := registry.Register(prom.ShutdownDrainSeconds); err != nil {
|
|
return err
|
|
}
|
|
if err := registry.Register(prom.ShutdownHardCloses); err != nil {
|
|
return err
|
|
}
|
|
if err := registry.Register(prom.ShutdownCloseErrors); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|