Add logs for method UpdateBuilder.ExecContext.

This commit is contained in:
Владислав Весельский 2024-03-13 16:06:39 +03:00
parent 3db7e50f1a
commit f1ec6d0fc6
1 changed files with 9 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import (
"time" "time"
"go.opentelemetry.io/otel" "go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/codes"
) )
const tracerName = "git.bit5.ru/backend/dbr" const tracerName = "git.bit5.ru/backend/dbr"
@ -218,5 +219,12 @@ func (b *UpdateBuilder) ExecContext(ctx context.Context) (sql.Result, error) {
_, span := tracer.Start(ctx, "UpdateBuilder.ExecContext") _, span := tracer.Start(ctx, "UpdateBuilder.ExecContext")
defer span.End() defer span.End()
return b.Exec() res, err := b.Exec()
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Error())
return nil, err
}
return res, err
} }