-
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
perf(export): do not allocate arrays if resource has no pending async attributes #4550
perf(export): do not allocate arrays if resource has no pending async attributes #4550
Conversation
130b958
to
c5b52e2
Compare
I am not sure that the benchmarks are very representational though, they fluctuate a lot and the numbers are suspiciously close to just creating spans |
c30f8ff
to
d38b316
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4550 +/- ##
==========================================
- Coverage 92.84% 92.84% -0.01%
==========================================
Files 328 327 -1
Lines 9487 9471 -16
Branches 2035 2032 -3
==========================================
- Hits 8808 8793 -15
+ Misses 679 678 -1
|
dbc220e
to
9daef95
Compare
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.
Thanks! Please also add a changelog entry under CHANGELOG.md
(scope is sdk-trace-base, enhancement).
Ad benchmarks: I think they're not too representative in his case as they all only use a single span. If there was a benchmark with thousands of spans I think the improvement may be more visible.
packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts
Show resolved
Hide resolved
9daef95
to
3fc1573
Compare
3fc1573
to
a4f45c7
Compare
Co-authored-by: Marc Pichler <[email protected]>
… attributes (open-telemetry#4550) * perf(eport): do not allocate arrays if resource has no pending async attributes * perf(export): do not use splice if fit in one batch * Update CHANGELOG.md Co-authored-by: Marc Pichler <[email protected]> --------- Co-authored-by: Marc Pichler <[email protected]>
Which problem is this PR solving?
OpenTelemetry is producing too much overhead for scenarios with significant load. One of the example is BatchSpanExporter, that is allocating array of batch size only to check is it has any pending attributes.
Fixes # (issue)
Short description of the changes
Replaced map & filter with a simple loop.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Benchmarks:
Before
create spans (10 attributes) x 689,041 ops/sec ±1.54% (92 runs sampled)
BatchSpanProcessor process span x 660,065 ops/sec ±1.08% (95 runs sampled)
After:
create spans (10 attributes) x 688,731 ops/sec ±1.15% (94 runs sampled)
BatchSpanProcessor process span x 673,550 ops/sec ±1.01% (93 runs sampled)
Checklist: