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 +12
-7
lines changed
contrib/opencensus-ext-azure
opencensus/ext/azure/trace_exporter Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 22
33## Unreleased
44
5+ - Fix export of exception information in traces
6+ ([ #1187 ] ( https://github.com/census-instrumentation/opencensus-python/pull/1187 ) )
7+
58## 1.1.8
69
710Released 2023-01-18
Original file line number Diff line number Diff line change @@ -96,7 +96,8 @@ def span_data_to_envelope(self, sd):
9696 )
9797 if sd .span_kind == SpanKind .SERVER :
9898 if ERROR_MESSAGE in sd .attributes :
99- envelope .name = 'Microsoft.ApplicationInsights.Exception'
99+ exc_env = Envelope (** envelope )
100+ exc_env .name = 'Microsoft.ApplicationInsights.Exception'
100101 data = ExceptionData (
101102 exceptions = [{
102103 'id' : 1 ,
@@ -107,8 +108,8 @@ def span_data_to_envelope(self, sd):
107108 'parsedStack' : sd .attributes .get (STACKTRACE , None )
108109 }],
109110 )
110- envelope .data = Data (baseData = data , baseType = 'ExceptionData' )
111- yield envelope
111+ exc_env .data = Data (baseData = data , baseType = 'ExceptionData' )
112+ yield exc_env
112113
113114 envelope .name = 'Microsoft.ApplicationInsights.Request'
114115 data = Request (
Original file line number Diff line number Diff line change @@ -498,7 +498,7 @@ def test_span_data_to_envelope(self):
498498 'RequestData' )
499499
500500 # SpanKind.SERVER HTTP - with exceptions
501- envelopes = exporter .span_data_to_envelope (SpanData (
501+ envelopes = list ( exporter .span_data_to_envelope (SpanData (
502502 name = 'test' ,
503503 context = SpanContext (
504504 trace_id = '6e0c63257de34c90bf9efcd03927272e' ,
@@ -529,9 +529,10 @@ def test_span_data_to_envelope(self):
529529 same_process_as_parent_span = None ,
530530 child_span_count = None ,
531531 span_kind = SpanKind .SERVER ,
532- ))
532+ )))
533+ self .assertEqual (len (envelopes ), 2 )
533534
534- envelope = next ( envelopes )
535+ envelope = envelopes [ 0 ]
535536 self .assertEqual (
536537 envelope .iKey ,
537538 '12345678-1234-5678-abcd-12345678abcd' )
@@ -551,7 +552,7 @@ def test_span_data_to_envelope(self):
551552 envelope .data .baseType ,
552553 'ExceptionData' )
553554
554- envelope = next ( envelopes )
555+ envelope = envelopes [ 1 ]
555556 self .assertEqual (
556557 envelope .iKey ,
557558 '12345678-1234-5678-abcd-12345678abcd' )
You can’t perform that action at this time.
0 commit comments