From 5801184782450bf30a4f8a8952aa649f7919b1f9 Mon Sep 17 00:00:00 2001 From: Vladislav Veselskiy Date: Thu, 14 Mar 2024 13:46:49 +0300 Subject: [PATCH] Change span attributes for func SaveRow. --- save.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/save.go b/save.go index c0053ad..0f2dea2 100644 --- a/save.go +++ b/save.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" ) @@ -89,10 +90,10 @@ func SaveRow(ctx context.Context, db *db.DBC, dataItem meta.IMetaStruct) error { sqlSmt := createInsertSQLForFields(ctx, tableName, fields, 1 /*one_row*/) span.SetAttributes( - attribute.String("table", tableName), - attribute.String("sql", sqlSmt), - //semconv.DBSQLTableKey.String(tableName), - //semconv.DBStatementKey.String(sqlSmt), + semconv.DBSystemKey.String("mysql"), + semconv.DBSQLTableKey.String(tableName), + semconv.DBStatementKey.String(sqlSmt), + semconv.DBOperationKey.String("INSERT"), ) updateBuilder := db.UpdateBySQL(sqlSmt, params...)