From f1ec6d0fc6b0ac0999a56c3604e8c8deba82df1c Mon Sep 17 00:00:00 2001 From: Vladislav Veselskiy Date: Wed, 13 Mar 2024 16:06:39 +0300 Subject: [PATCH] Add logs for method UpdateBuilder.ExecContext. --- update.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/update.go b/update.go index b6e6f9a..b8e2f72 100644 --- a/update.go +++ b/update.go @@ -8,6 +8,7 @@ import ( "time" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/codes" ) 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") 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 }