mirror of https://github.com/grafana/grafana.git
Instrumentation: Improve instrumentation for database migrations (#74659)
This commit is contained in:
parent
247d91be2b
commit
edc34fc836
|
|
@ -239,6 +239,7 @@ func (mg *Migrator) run() (err error) {
|
|||
}
|
||||
|
||||
func (mg *Migrator) exec(m Migration, sess *xorm.Session) error {
|
||||
start := time.Now()
|
||||
mg.Logger.Info("Executing migration", "id", m.Id())
|
||||
|
||||
condition := m.GetCondition()
|
||||
|
|
@ -271,10 +272,12 @@ func (mg *Migrator) exec(m Migration, sess *xorm.Session) error {
|
|||
}
|
||||
|
||||
if err != nil {
|
||||
mg.Logger.Error("Executing migration failed", "id", m.Id(), "error", err)
|
||||
mg.Logger.Error("Executing migration failed", "id", m.Id(), "error", err, "duration", time.Since(start))
|
||||
return err
|
||||
}
|
||||
|
||||
mg.Logger.Info("Migration successfully executed", "id", m.Id(), "duration", time.Since(start))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue