-
Notifications
You must be signed in to change notification settings - Fork 327
Add get data of span method #1008
base: master
Are you sure you want to change the base?
Conversation
return the data of span to allow accessing all info of a span. just return the value of data instead a pointer to avoid changing by user.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
|
CLAs look good, thanks! |
As explained in #1007 there is no need to provide access to the entire span data payload for correlation purposes. This is what SpanContext is for. The other problem is you return a shallow copy of span data which would allow for mutating for instance the Attributes map (and get some concurrent access nasties). |
span data will not init if span is not sampled and not enable local span storage. so add a flag to force generate span data. this operation will have a little more memery overhead, but it can be use to get all information when we get a span. we can use the information to do logging and rebuild the trace from logs. also change SpanData method to use makeSpanData result, because shallow copy of span.data would allow for mutating for instance the Attributes map (and get some concurrent access nasties).
Why do we need to give SetForceGenerateSpanData as an option to the user? @bogdandrutu, do we have any requirements about immutability of the span data? |
but i cann't get parent span id from SpanContext, could add a parent span id to the SpanContext? |
return the data of span to allow accessing all info of a span.
just return the value of data instead a pointer to avoid changing by user.
in order to solve #1007 .