forked from MTSR/mapserver
tiledb monitoring
This commit is contained in:
parent
9a249a92e9
commit
5b11474789
23
server/tiledb/prometheus.go
Normal file
23
server/tiledb/prometheus.go
Normal file
@ -0,0 +1,23 @@
|
||||
package tiledb
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
var (
|
||||
tiledbSaveDuration = prometheus.NewHistogram(prometheus.HistogramOpts{
|
||||
Name: "tiledb_save_durations",
|
||||
Help: "Histogram for tiledb save timings",
|
||||
Buckets: prometheus.LinearBuckets(0.005, 0.01, 10),
|
||||
})
|
||||
tiledbLoadDuration = prometheus.NewHistogram(prometheus.HistogramOpts{
|
||||
Name: "tiledb_load_durations",
|
||||
Help: "Histogram for tiledb load timings",
|
||||
Buckets: prometheus.LinearBuckets(0.005, 0.01, 10),
|
||||
})
|
||||
)
|
||||
|
||||
func init() {
|
||||
prometheus.MustRegister(tiledbSaveDuration)
|
||||
prometheus.MustRegister(tiledbLoadDuration)
|
||||
}
|
@ -1,12 +1,13 @@
|
||||
package tiledb
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/sirupsen/logrus"
|
||||
"io/ioutil"
|
||||
"mapserver/coords"
|
||||
"os"
|
||||
"strconv"
|
||||
"sync"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var mutex = &sync.RWMutex{}
|
||||
@ -36,6 +37,9 @@ func (this *TileDB) GC() {
|
||||
}
|
||||
|
||||
func (this *TileDB) GetTile(pos *coords.TileCoords) ([]byte, error) {
|
||||
timer := prometheus.NewTimer(tiledbLoadDuration)
|
||||
defer timer.ObserveDuration()
|
||||
|
||||
mutex.RLock()
|
||||
defer mutex.RUnlock()
|
||||
|
||||
@ -59,6 +63,9 @@ func (this *TileDB) GetTile(pos *coords.TileCoords) ([]byte, error) {
|
||||
}
|
||||
|
||||
func (this *TileDB) SetTile(pos *coords.TileCoords, tile []byte) error {
|
||||
timer := prometheus.NewTimer(tiledbSaveDuration)
|
||||
defer timer.ObserveDuration()
|
||||
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
|
||||
|
@ -72,7 +72,7 @@ func renderMapblocks(ctx *app.App, mblist []*mapblockparser.MapBlock) int {
|
||||
|
||||
//spin down worker pool
|
||||
close(jobs)
|
||||
|
||||
|
||||
for j := 0; j < ctx.Config.RenderingJobs; j++ {
|
||||
<-done
|
||||
}
|
||||
|
@ -26,11 +26,11 @@ var (
|
||||
Help: "Websocket client count",
|
||||
})
|
||||
mintestPlayers = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Name: "minetest_player_count",
|
||||
Name: "mapserver_minetest_player_count",
|
||||
Help: "game player count",
|
||||
})
|
||||
mintestMaxLag = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Name: "minetest_max_lag",
|
||||
Name: "mapserver_minetest_max_lag",
|
||||
Help: "Max lag",
|
||||
})
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user