When batching, same object is mutated destroying exception information#1187
When batching, same object is mutated destroying exception information#1187lzchen merged 4 commits intocensus-instrumentation:masterfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Good catch, please fix the build errors and then we can merge this. |
cb75eb7 to
211fa74
Compare
Thanks @lzchen. Updated the way the object is copied, so hopefully works now. Had some unrelated tests fail locally (prometheus extension), but I believe something is not properly setup in my environment. |
|
@calleo |
684ab6a to
c710688
Compare
…e the same object is mutated
…utated further down
Thanks' for reviewing. I've added this fix to the changelog now. |
While testing Azure Exporter to see if exceptions (and traces) where propagated correctly to Application Insights I noticed that stack traces ended upp in a custom field called "stacktrace" but they where not tagged as exceptions in Application Insights.
Each time an exception occurs within a span, the function
span_data_to_envelopewill yield twice. The problem is that the same envelope object is re-used and modified. The current tests won't fail because eachyieldis tested in isolation, given the nature ofnext.In my setup,
emitis always called with a batch of span's, meaning all of them are processed before sent to Application Insights. As a result I end up with two envelopes of typeMicrosoft.ApplicationInsights.Request. I would expect one of typeMicrosoft.ApplicationInsights.Exceptionand one ofMicrosoft.ApplicationInsights.Request.