tracing fixes #57
10
tx.go
10
tx.go
@ -24,6 +24,11 @@ func (w *wrapperTx) Commit() error {
|
|||||||
err := w.tx.Commit()
|
err := w.tx.Commit()
|
||||||
td := time.Since(ts)
|
td := time.Since(ts)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
w.span.AddLabels("error", true)
|
||||||
|
w.span.AddLabels("err", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
if w.opts.LoggerEnabled {
|
if w.opts.LoggerEnabled {
|
||||||
w.opts.Logger.Fields(w.opts.LoggerObserver(context.TODO(), "Commit", labelUnknown, td, err)...).Log(context.TODO(), w.opts.LoggerLevel)
|
w.opts.Logger.Fields(w.opts.LoggerObserver(context.TODO(), "Commit", labelUnknown, td, err)...).Log(context.TODO(), w.opts.LoggerLevel)
|
||||||
}
|
}
|
||||||
@ -40,6 +45,11 @@ func (w *wrapperTx) Rollback() error {
|
|||||||
err := w.tx.Rollback()
|
err := w.tx.Rollback()
|
||||||
td := time.Since(ts)
|
td := time.Since(ts)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
w.span.AddLabels("error", true)
|
||||||
|
w.span.AddLabels("err", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
if w.opts.LoggerEnabled {
|
if w.opts.LoggerEnabled {
|
||||||
w.opts.Logger.Fields(w.opts.LoggerObserver(context.TODO(), "Rollback", labelUnknown, td, err)...).Log(context.TODO(), w.opts.LoggerLevel)
|
w.opts.Logger.Fields(w.opts.LoggerObserver(context.TODO(), "Rollback", labelUnknown, td, err)...).Log(context.TODO(), w.opts.LoggerLevel)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user