1
0
forked from MTSR/mapserver
mapserver/server/web/prometheus.go
2019-02-15 08:36:48 +01:00

46 lines
1.3 KiB
Go

package web
import (
"github.com/prometheus/client_golang/prometheus"
)
var (
tilesCumulativeSize = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "tiles_cumulative_size_served",
Help: "Overall sent bytes of tiles",
},
)
tileServeDuration = prometheus.NewHistogram(prometheus.HistogramOpts{
Name: "tiles_serve_durations",
Help: "Histogram for tile serve timings",
Buckets: prometheus.LinearBuckets(0.005, 0.01, 10),
})
mapobjectServeDuration = prometheus.NewHistogram(prometheus.HistogramOpts{
Name: "mapobject_serve_durations",
Help: "Histogram for mapobject serve timings",
Buckets: prometheus.LinearBuckets(0.005, 0.01, 10),
})
wsClients = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "ws_client_count",
Help: "Websocket client count",
})
mintestPlayers = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "minetest_player_count",
Help: "game player count",
})
mintestMaxLag = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "minetest_max_lag",
Help: "Max lag",
})
)
func init() {
prometheus.MustRegister(tilesCumulativeSize)
prometheus.MustRegister(tileServeDuration)
prometheus.MustRegister(mapobjectServeDuration)
prometheus.MustRegister(wsClients)
prometheus.MustRegister(mintestPlayers)
prometheus.MustRegister(mintestMaxLag)
}