Instrumentation: Improve instrumentation for database migrations (#74659)

pull/74646/head
Marcus Efraimsson 2 years ago committed by GitHub
parent 247d91be2b
commit edc34fc836
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      pkg/services/sqlstore/migrator/migrator.go

@ -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…
Cancel
Save