-
Notifications
You must be signed in to change notification settings - Fork 873
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
Add an optimized Attributes implementation for instrumenter #3136
Conversation
* couple of methods still require copying to satisfy the interface contracts, but in practice | ||
* should never be called by user code even though they can. | ||
*/ | ||
final class UnsafeAttributes extends HashMap<AttributeKey<?>, Object> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkwatson It's your favorite pattern again :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
Context context = parentContext; | ||
|
||
for (RequestListener requestListener : requestListeners) { | ||
context = requestListener.start(context, attributes); | ||
} | ||
|
||
attributes.forEach((key, value) -> spanBuilder.setAttribute((AttributeKey) key, value)); | ||
spanBuilder.setAllAttributes(attributes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any ideas how we can init the SpanBuilder
with the already built Attributes
map, to avoid this copy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm - I guess it requires an internal use API for that in the SDK. We can try it but it'll be more hacky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to clarify, did not mean for this pr, something (possibly) for the future..
Now that this is being used in much of our instrumentation better fix the performance regression :)
After
Before