This repository was archived by the owner on Jun 16, 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 2
2
3
3
## Unreleased
4
4
5
+ - Fix missing/None fields in ` ExceptionDetails `
6
+ ([ #1232 ] ( https://github.com/census-instrumentation/opencensus-python/pull/1232 ) )
7
+
5
8
## 1.1.11
6
9
7
10
Released 2023-10-12
Original file line number Diff line number Diff line change @@ -231,6 +231,11 @@ def log_record_to_envelope(self, record):
231
231
if exctype is not None :
232
232
exc_type = exctype .__name__
233
233
234
+ if not exc_type :
235
+ exc_type = "Exception"
236
+ if not message :
237
+ message = "Exception"
238
+
234
239
envelope .name = 'Microsoft.ApplicationInsights.Exception'
235
240
236
241
data = ExceptionData (
Original file line number Diff line number Diff line change @@ -96,16 +96,22 @@ def span_data_to_envelope(self, sd):
96
96
)
97
97
if sd .span_kind == SpanKind .SERVER :
98
98
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 = []
99
105
exc_env = Envelope (** envelope )
100
106
exc_env .name = 'Microsoft.ApplicationInsights.Exception'
101
107
data = ExceptionData (
102
108
exceptions = [{
103
109
'id' : 1 ,
104
110
'outerId' : 0 ,
105
111
'typeName' : sd .attributes .get (ERROR_NAME , '' ),
106
- 'message' : sd . attributes [ ERROR_MESSAGE ] ,
112
+ 'message' : message ,
107
113
'hasFullStack' : STACKTRACE in sd .attributes ,
108
- 'parsedStack' : sd . attributes . get ( STACKTRACE , None )
114
+ 'parsedStack' : stack_trace
109
115
}],
110
116
)
111
117
exc_env .data = Data (baseData = data , baseType = 'ExceptionData' )
You can’t perform that action at this time.
0 commit comments