feat: added api health endpoint that does not require auth and never creates sessions, returns db status as well. #3302

This commit is contained in:
Torkel Ödegaard
2017-04-25 17:17:45 +02:00
parent fe64ed424e
commit 368e847d12
4 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
package sqlstore
import (
"github.com/grafana/grafana/pkg/bus"
m "github.com/grafana/grafana/pkg/models"
)
func init() {
bus.AddHandler("sql", GetDBHealthQuery)
}
func GetDBHealthQuery(query *m.GetDBHealthQuery) error {
return x.Ping()
}

View File

@@ -158,6 +158,7 @@ func getEngine() (*xorm.Engine, error) {
} else {
engine.SetMaxOpenConns(DbCfg.MaxOpenConn)
engine.SetMaxIdleConns(DbCfg.MaxIdleConn)
engine.SetLogger(&xorm.DiscardLogger{})
// engine.SetLogger(NewXormLogger(log.LvlInfo, log.New("sqlstore.xorm")))
// engine.ShowSQL = true
// engine.ShowInfo = true