@@ -94,42 +94,20 @@ internal static Activity CommandStart(FbCommand command)
9494 {
9595 foreach ( FbParameter p in command . Parameters )
9696 {
97- var name = p . ParameterName ;
98- var value = NormalizeDbNull ( p . InternalValue ) ;
99- activity . SetTag ( $ "db.query.parameter.{ name } ", value ) ;
97+ activity . SetTag ( $ "db.query.parameter.{ p . ParameterName } ", p . InternalValue == DBNull . Value ? null : p . InternalValue ) ;
10098 }
10199 }
102100
103- // Only for explicit transactions.
104- if ( command . Transaction != null )
105- {
106- FbTransactionInfo fbInfo = new FbTransactionInfo ( command . Transaction ) ;
107-
108- var transactionId = fbInfo . GetTransactionId ( ) ;
109- activity . SetTag ( $ "db.transaction_id", transactionId ) ;
110-
111- // TODO: Firebird 4+ only (or remove?)
112- /*
113- var snapshotId = fbInfo.GetTransactionSnapshotNumber();
114- if (snapshotId != 0)
115- {
116- activity.SetTag($"db.snapshot_id", snapshotId);
117- }
118- */
119- }
120-
121101 return activity ;
122102 }
123103
124- internal static void CommandException ( Activity activity , Exception exception , bool escaped = true )
104+ internal static void CommandException ( Activity activity , Exception exception )
125105 {
126- // Reference: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/exceptions/exceptions-spans.md
127106 activity . AddEvent (
128107 new ( "exception" , tags : new ( )
129108 {
130109 { "exception.message" , exception . Message } ,
131110 { "exception.type" , exception . GetType ( ) . FullName } ,
132- { "exception.escaped" , escaped } ,
133111 { "exception.stacktrace" , exception . ToString ( ) } ,
134112 } )
135113 ) ;
@@ -145,10 +123,5 @@ internal static void CommandException(Activity activity, Exception exception, bo
145123 activity . SetStatus ( ActivityStatusCode . Error , errorDescription ) ;
146124 activity . Dispose ( ) ;
147125 }
148-
149- private static object NormalizeDbNull ( object value ) =>
150- value == DBNull . Value || value == null
151- ? null
152- : value ;
153126 }
154127}
0 commit comments