1
0
forked from MTSR/mapserver

tiledb monitoring

This commit is contained in:
NatureFreshMilk 2019-02-22 14:18:00 +01:00
parent 9a249a92e9
commit 5b11474789
4 changed files with 34 additions and 4 deletions

View 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)
}

View File

@ -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()

View File

@ -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
}

View File

@ -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",
})
)