This repository was archived by the owner on Sep 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
contrib/opencensus-ext-azure Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 22
33## Unreleased
44
5+ - Fix missing/None fields in ` ExceptionDetails `
6+ ([ #1232 ] ( https://github.com/census-instrumentation/opencensus-python/pull/1232 ) )
7+
58## 1.1.11
69
710Released 2023-10-12
Original file line number Diff line number Diff line change @@ -231,6 +231,11 @@ def log_record_to_envelope(self, record):
231231 if exctype is not None :
232232 exc_type = exctype .__name__
233233
234+ if not exc_type :
235+ exc_type = "Exception"
236+ if not message :
237+ message = "Exception"
238+
234239 envelope .name = 'Microsoft.ApplicationInsights.Exception'
235240
236241 data = ExceptionData (
Original file line number Diff line number Diff line change @@ -96,16 +96,22 @@ def span_data_to_envelope(self, sd):
9696 )
9797 if sd .span_kind == SpanKind .SERVER :
9898 if ERROR_MESSAGE in sd .attributes :
99+ message = sd .attributes .get (ERROR_MESSAGE )
100+ if not message :
101+ message = "Exception"
102+ stack_trace = sd .attributes .get (STACKTRACE , [])
103+ if not hasattr (stack_trace , '__iter__' ):
104+ stack_trace = []
99105 exc_env = Envelope (** envelope )
100106 exc_env .name = 'Microsoft.ApplicationInsights.Exception'
101107 data = ExceptionData (
102108 exceptions = [{
103109 'id' : 1 ,
104110 'outerId' : 0 ,
105111 'typeName' : sd .attributes .get (ERROR_NAME , '' ),
106- 'message' : sd . attributes [ ERROR_MESSAGE ] ,
112+ 'message' : message ,
107113 'hasFullStack' : STACKTRACE in sd .attributes ,
108- 'parsedStack' : sd . attributes . get ( STACKTRACE , None )
114+ 'parsedStack' : stack_trace
109115 }],
110116 )
111117 exc_env .data = Data (baseData = data , baseType = 'ExceptionData' )
You can’t perform that action at this time.
0 commit comments