mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
14
pkg/services/sqlstore/health.go
Normal file
14
pkg/services/sqlstore/health.go
Normal 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()
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user