diff --git a/collection.go b/collection.go index 8d0e51c..efb1600 100644 --- a/collection.go +++ b/collection.go @@ -146,7 +146,7 @@ func (coll *DataCollection) saveWithoutMask(ctx context.Context) error { countRows := len(coll.Items) span.SetAttributes( - attribute.String("db.sql.table", tableName), + attribute.String("table", tableName), attribute.Int("field_amount", countFields), attribute.Int("item_amount", countRows), ) @@ -161,7 +161,10 @@ func (coll *DataCollection) saveWithoutMask(ctx context.Context) error { if ownerValue == uint32(0) { rows[start+coll.ownerFieldIndex] = coll.OwnerId } else if ownerValue != coll.OwnerId { - return errors.Errorf("Wrong owner_id in %s value %d (!= %d)", tableName, ownerValue, coll.OwnerId) + err := errors.Errorf("Wrong owner_id in %s value %d (!= %d)", tableName, ownerValue, coll.OwnerId) + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err } offset++ } @@ -169,7 +172,10 @@ func (coll *DataCollection) saveWithoutMask(ctx context.Context) error { sqlSmt := createInsertSQLForFields(ctx, tableName, fields, countRows) _, err := coll.Db.UpdateBySQL(sqlSmt, rows...).Exec() if err != nil { - return errors.Errorf("error: %s, sql: %s", err.Error(), sqlSmt) + resultErr := errors.Errorf("error: %s, sql: %s", err.Error(), sqlSmt) + span.RecordError(resultErr) + span.SetStatus(codes.Error, resultErr.Error()) + return resultErr } return nil }