Skip to content

Commit

Permalink
Copying the envelope will make sure the exception envelope won't be m…
Browse files Browse the repository at this point in the history
…utated further down
  • Loading branch information
calleo committed Feb 6, 2023
1 parent 6bb288f commit a6ecb7f
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def span_data_to_envelope(self, sd):
)
if sd.span_kind == SpanKind.SERVER:
if ERROR_MESSAGE in sd.attributes:
envelope.name = 'Microsoft.ApplicationInsights.Exception'
exception_envelope = envelope.copy()
exception_envelope.name = 'Microsoft.ApplicationInsights.Exception'
data = ExceptionData(
exceptions=[{
'id': 1,
Expand All @@ -107,8 +108,8 @@ def span_data_to_envelope(self, sd):
'parsedStack': sd.attributes.get(STACKTRACE, None)
}],
)
envelope.data = Data(baseData=data, baseType='ExceptionData')
yield envelope
exception_envelope.data = Data(baseData=data, baseType='ExceptionData')
yield exception_envelope

envelope.name = 'Microsoft.ApplicationInsights.Request'
data = Request(
Expand Down

0 comments on commit a6ecb7f

Please sign in to comment.