From 5af4d90edbcdf8541270be6289d6448f9e928c7e Mon Sep 17 00:00:00 2001 From: Vladislav Veselskiy Date: Wed, 13 Mar 2024 15:31:17 +0300 Subject: [PATCH] Add logs for method DataCollection.saveByMask. --- collection.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/collection.go b/collection.go index 3384633..8d0e51c 100644 --- a/collection.go +++ b/collection.go @@ -92,7 +92,7 @@ func (coll *DataCollection) saveByMask(ctx context.Context) error { tableName := coll.GetTableName() span.SetAttributes( - attribute.String("db.sql.table", tableName), + attribute.String("table", tableName), ) for _, item := range coll.Items { @@ -125,7 +125,10 @@ func (coll *DataCollection) saveByMask(ctx context.Context) error { log_len = 200 } - return errors.Errorf("%s (%s)", err.Error(), sqlSmt[0:log_len]) + resultErr := errors.Errorf("%s (%s)", err.Error(), sqlSmt[0:log_len]) + span.RecordError(resultErr) + span.SetStatus(codes.Error, resultErr.Error()) + return resultErr } } return nil