diff --git a/src/SkyApm.Diagnostics.SmartSql/SmartSqlTracingDiagnosticProcessor.cs b/src/SkyApm.Diagnostics.SmartSql/SmartSqlTracingDiagnosticProcessor.cs index a5bf8684..55d00df6 100644 --- a/src/SkyApm.Diagnostics.SmartSql/SmartSqlTracingDiagnosticProcessor.cs +++ b/src/SkyApm.Diagnostics.SmartSql/SmartSqlTracingDiagnosticProcessor.cs @@ -26,6 +26,7 @@ using SkyApm.Tracing.Segments; using SmartSql; using SmartSql.Diagnostics; +using SmartSql.Utils; namespace SkyApm.Diagnostics.SmartSql { @@ -249,7 +250,11 @@ public void BeforeCommandExecuterExecute([Object]CommandExecuterExecuteBeforeEve var context = CreateSmartSqlLocalSegmentContext(eventData.Operation); if (eventData.ExecutionContext.Request.RealSql != null) { - context.Span.AddTag(Common.Tags.DB_STATEMENT, eventData.ExecutionContext.Request.RealSql); + var sql = eventData.ExecutionContext.FormatSql(true); + var spliter = "Sql with parameter value: "; + var startIndex = sql.IndexOf(spliter) + spliter.Length; + sql = sql.Substring(startIndex); + context.Span.AddTag(Common.Tags.DB_STATEMENT, sql); } } [DiagnosticName(SmartSqlDiagnosticListenerExtensions.SMART_SQL_AFTER_COMMAND_EXECUTER_EXECUTE)]