File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,17 @@ static class Telemetry
2222
2323 public static void RecordException ( this Activity ? activity , Exception e )
2424 {
25- // See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/exceptions.md
26- activity ? . AddEvent ( new ActivityEvent ( "exception" , tags : new ( )
25+ if ( activity != null )
2726 {
28- { "exception.message" , e . Message } ,
29- { "exception.type" , e . GetType ( ) . FullName } ,
30- { "exception.stacktrace" , e . ToString ( ) } ,
31- } ) ) ;
27+ activity . SetStatus ( ActivityStatusCode . Error , e . Message ) ;
28+
29+ // See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/exceptions.md
30+ activity . AddEvent ( new ActivityEvent ( "exception" , tags : new ( )
31+ {
32+ { "exception.message" , e . Message } ,
33+ { "exception.type" , e . GetType ( ) . FullName } ,
34+ { "exception.stacktrace" , e . ToString ( ) } ,
35+ } ) ) ;
36+ }
3237 }
3338}
You can’t perform that action at this time.
0 commit comments