-
Notifications
You must be signed in to change notification settings - Fork 832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert span to ReadableSpan before sending to span processor #1902
Comments
As a I could imagine that there are I assume a deep copy + sealing of all spans is quite costly. Passing sealed/frozen objects to users is in my opinion not what one expects. Usually I assume that I can always add a private symbol to an object. And still this doesn't protect 100% for missues as a We are in JavaScript world and if people want to shoot themself in their foot they will always find a way to do this. How is this done in other languages? |
@Flarna you weren't at last sig meeting. We won't be sealing the object, but we will map the values so only this what is required will be sent and nothing more. currently we are sending the whole span which is more then only a readable span. |
So this means the object passed to |
if you look closely you will see that even the type of those 2 functions is different. |
Hmm I didn't think about this before. IMO that might be a dealbreaker. A span processor needs to be able to use
The type can be different to encourage users not to modify the span or call functions in |
Well the spec says that |
The spec also says exceptions are allowed in cases where it isn't practical. deep freeze may be quite costly. |
Well, a |
deep freeze on my machine for 1k spans with 1 attribute takes around 5ms-6ms |
source for deep freeze |
This could be a memory leak in the case span is not ended |
That's the reason why I prefer to set a private symbol in such cases. I still don't understand what the benefit of freezing/creation of a fresh readable span is. Which problem does/should this solve? The IMHO doing this doesn't protect from misuse but adds overhead and risk of surprises for users. But if there is consensus to go this path I will not block it. There is a reason why I'm not a big fan of read-only/freezing: A while ago I added a read-only property to |
According to spec the main purpose of |
As a user I would read spec which says that when span is ended it is only readable and cannot be changed. Imagine now a scenario where you have multiple span processors or/and exporters etc. and one of such will modify the span. It will suddenly affect all processors and spans. If you freeze span it cannot be modified and thus nothing strange can happen. You have the same with badge I can guess that it was similar approach with that and similar reasons. |
FWIW I implemented already a Currently I rely on As mentioned above this can be fixed by replacing the single
But considering the overhead I would vote for an opt-in. if someone wonders why we send in progress spans to our backend: it allows to correlate the whole span tree early even if there is a long running span somewhere in the middle. e.g. ShortSpan1 => LongSpan2 => ShortSpan3 |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
This issue was closed because it has been stale for 14 days with no activity. |
Currently when Span ends it sends the whole self to the span processor. Span Processor expects the span to be ReadableSpan but in fact the span that is being sent is a whole object with methods etc. I think we should send only an object in correct format. We could have for example a private function "_serialize" or "_toReadableSpan" which will send only required data and nothing more. We should also think about sealing the data so it cannot be modified.
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#interface-definition
The text was updated successfully, but these errors were encountered: