mirror of https://github.com/tidwall/tile38.git
cleanup / fix tests
This commit is contained in:
parent
a233aaa66e
commit
f448599e72
|
@ -15,7 +15,7 @@ var (
|
||||||
these metrics are taken from basicStats() / extStats()
|
these metrics are taken from basicStats() / extStats()
|
||||||
by accessing the map and directly exporting the value found
|
by accessing the map and directly exporting the value found
|
||||||
*/
|
*/
|
||||||
"num_collections": prometheus.NewDesc("tile38_collections_total", "Total number of collections", nil, nil),
|
"num_collections": prometheus.NewDesc("tile38_collections", "Total number of collections", nil, nil),
|
||||||
"pid": prometheus.NewDesc("tile38_pid", "", nil, nil),
|
"pid": prometheus.NewDesc("tile38_pid", "", nil, nil),
|
||||||
"aof_size": prometheus.NewDesc("tile38_aof_size_bytes", "", nil, nil),
|
"aof_size": prometheus.NewDesc("tile38_aof_size_bytes", "", nil, nil),
|
||||||
"num_hooks": prometheus.NewDesc("tile38_hooks_total", "", nil, nil),
|
"num_hooks": prometheus.NewDesc("tile38_hooks_total", "", nil, nil),
|
||||||
|
@ -57,9 +57,7 @@ func (s *Server) MetricsHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
s,
|
s,
|
||||||
)
|
)
|
||||||
|
|
||||||
h := promhttp.HandlerFor(reg, promhttp.HandlerOpts{})
|
promhttp.HandlerFor(reg, promhttp.HandlerOpts{}).ServeHTTP(w, r)
|
||||||
|
|
||||||
h.ServeHTTP(w, r)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) Describe(ch chan<- *prometheus.Desc) {
|
func (s *Server) Describe(ch chan<- *prometheus.Desc) {
|
||||||
|
@ -69,6 +67,9 @@ func (s *Server) Describe(ch chan<- *prometheus.Desc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) Collect(ch chan<- prometheus.Metric) {
|
func (s *Server) Collect(ch chan<- prometheus.Metric) {
|
||||||
|
s.mu.RLock()
|
||||||
|
defer s.mu.RUnlock()
|
||||||
|
|
||||||
m := make(map[string]interface{})
|
m := make(map[string]interface{})
|
||||||
s.basicStats(m)
|
s.basicStats(m)
|
||||||
s.extStats(m)
|
s.extStats(m)
|
||||||
|
@ -87,7 +88,7 @@ func (s *Server) Collect(ch chan<- prometheus.Metric) {
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
add stats per collection
|
add objects/points/strings stats for each collection
|
||||||
*/
|
*/
|
||||||
s.cols.Ascend(nil, func(v interface{}) bool {
|
s.cols.Ascend(nil, func(v interface{}) bool {
|
||||||
c := v.(*collectionKeyContainer)
|
c := v.(*collectionKeyContainer)
|
||||||
|
|
|
@ -100,7 +100,7 @@ func main() {
|
||||||
|
|
||||||
func startTile38Server() {
|
func startTile38Server() {
|
||||||
log.Println("start tile38 server")
|
log.Println("start tile38 server")
|
||||||
err := server.Serve("localhost", tile38Port, "data", false)
|
err := server.Serve("localhost", tile38Port, "data", false, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ func mockOpenServer() (*mockServer, error) {
|
||||||
s := &mockServer{port: port}
|
s := &mockServer{port: port}
|
||||||
tlog.SetOutput(logOutput)
|
tlog.SetOutput(logOutput)
|
||||||
go func() {
|
go func() {
|
||||||
if err := server.Serve("localhost", port, dir, true); err != nil {
|
if err := server.Serve("localhost", port, dir, true, ""); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in New Issue