-
Notifications
You must be signed in to change notification settings - Fork 893
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
Links have to be deserialized all the time: instrumentation perf concern #305
Comments
You have a "LazyAddLink" option on the builder, so the extraction will happen only if needed. But I do agree that will at least force one object allocation for each Link. |
In an operational case, the funny thing with |
You are talking too much .net :)) Not sure I understand the last part of the comment, can you clarify exactly what is the problem? |
sorry :)
So imagine you do There is an additional cost that depends on how library works and just accessing message properties may cost - regardless of what you parse, because the library could be optimized for never-access-properties scenarios and initializes properties on first access. There is exactly the same concern in ASP.NET (sorry, talking .NET again) which initializes headers lazily, I.e. if you just run perf test without instrumentation and with it (with sampling set to 0) you'll get significant perf hit, because you still have to access headers to parse context before you make sampling decision. This is very synthetic though as normally an app would want to access headers even implicitly and this is amortized cost. I don't know how to solve this problem and if it is feasible to solve it. But I want to make it explicit that
|
We do not execute the "LazyFormatters" unless is necessary. To count the number of links and enforce a limit is not necessary to decode the Link. Am I missing something? So you can avoid executing all the formatting if the SDK knows that there is no chance in sampling this request. |
yes, and we should have lazy extract too |
Hey @lmolkova is this solved? Is there any work left to do? |
@carlosalberto this is partially solved with lazy formatters to the extent possible. There is no way to optimize it further for the default sampling and existing filtering approach. I'm closing the issue as there are no remaining work items left. |
@lmolkova Thanks for the clarification, truly appreciated. |
In batching scenarios, when multiple messages are received e.g. from Kafka, the instrumentation library has to extract all the links from all messages, populate array of links and set it on the span before sampling decision is made. Or without even knowing if instrumentation is operational.
This is the cost that the instrumentation library pays for all users in all cases. This could be blocking for some libraries (like messaging services SDKs) to instrument themselves directly without requiring explicit user choice/additional plugins or bridges.
It would make sense to give the instrumentation library a legit and very fast hint that instrumentation is operational. This at least eliminates concern around noop case.
Regarding sampling, I believe what sampling otep means is that if any link is sampled in, it should be treated as
ParentSampledFlag = true
.So in this case, deserializing all the links is absolutely required before any span is created and this is inevitable perf hit on each message.
Is my understanding correct?
The text was updated successfully, but these errors were encountered: