-
Notifications
You must be signed in to change notification settings - Fork 306
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
PROF-8545: (Simplified) Restore eager release of tags, adapt endpoint profiling code #3759
Conversation
Overall package sizeSelf size: 5.44 MB Dependency sizes
🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov Report
@@ Coverage Diff @@
## master #3759 +/- ##
========================================
Coverage 85.91% 85.92%
========================================
Files 225 227 +2
Lines 9138 9326 +188
Branches 33 33
========================================
+ Hits 7851 8013 +162
- Misses 1287 1313 +26
... and 4 files with indirect coverage changes 📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
BenchmarksBenchmark execution time: 2023-11-08 14:26:02 Comparing candidate commit d8b4b43 in PR branch Found 17 performance improvements and 1 performance regressions! Performance is the same for 467 metrics, 7 unstable metrics. scenario:exporting-pipeline-0.4-16
scenario:exporting-pipeline-0.4-18
scenario:exporting-pipeline-0.4_with_stats-16
scenario:exporting-pipeline-0.4_with_stats-18
scenario:exporting-pipeline-0.5-16
scenario:exporting-pipeline-0.5-18
scenario:exporting-pipeline-0.5_with_stats-16
scenario:exporting-pipeline-0.5_with_stats-18
scenario:plugin-graphql-with-depth-off-18
scenario:spans-finish-later-16
|
d85482a
to
5677da3
Compare
b111fb6
to
a3fecf6
Compare
tracer.trace('name', {}, () => {}) | ||
const trace = tracer._exporter.export.getCall(0).args[0][0] | ||
expect(trace).to.have.property(EXPORT_SERVICE_NAME, 'service') | ||
expect(trace.meta).to.not.have.property(BASE_SERVICE) | ||
}) | ||
|
||
it('should be set when tracer.trace service matched configured service', () => { |
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.
it('should be set when tracer.trace service matched configured service', () => { | |
it('should not be set when tracer.trace service matched configured service', () => { |
As you mentioned this test makes no sense with that missing not
🤦
@@ -120,6 +120,7 @@ class NativeWallProfiler { | |||
this._pprof.time.setContext(this._currentContext) | |||
this._lastSpan = undefined | |||
this._lastStartedSpans = undefined | |||
this._webTags = undefined |
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.
Can this be cleaned up after it's not longer needed so that the tags can be GCed?
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.
What do you mean? We'll keep updating this variable on every async_hook.enter()
with the tags of some currently active span, so we don't hold on to any particular tags object for very long. We'll hold on longer to those that were active when we took a sample (once every 10ms) by transferring the reference into the _currentContext
. That reference will go away next time we serialize the profile (once every minute.) We can't do better than that. In fact, we can – we can also release the tags as soon as the span ends; I do have that functionality in the other PR, #3755 where I added optimizations to release those as eagerly as possible, but Stephen considered it too hard to review at once so I started with this simplified one instead. I plan to add optimizations back in gradually.
One point of improvement here would be to reset the references when the profiler is stopped, but that won't make much difference.
This ensures we hold a reference to the tags object the span used before it was finished. Even if it finishes between `_enter` and `_updateContext` and its tags get replaced by an empty object, we will still hold the reference to the populated one in `_updateContext`.
247193c
to
d8b4b43
Compare
…de (#3759) * Restores eager release of tags for exported spans in `process_spans.js`. * Moves tag fetching in `wall.js` from `_updateContext` to `_enter` to compensate for above. * Fixes some tests that relied on tags being lazily released.
…de (#3759) * Restores eager release of tags for exported spans in `process_spans.js`. * Moves tag fetching in `wall.js` from `_updateContext` to `_enter` to compensate for above. * Fixes some tests that relied on tags being lazily released.
…de (#3759) * Restores eager release of tags for exported spans in `process_spans.js`. * Moves tag fetching in `wall.js` from `_updateContext` to `_enter` to compensate for above. * Fixes some tests that relied on tags being lazily released.
…de (#3759) * Restores eager release of tags for exported spans in `process_spans.js`. * Moves tag fetching in `wall.js` from `_updateContext` to `_enter` to compensate for above. * Fixes some tests that relied on tags being lazily released.
…de (#3759) * Restores eager release of tags for exported spans in `process_spans.js`. * Moves tag fetching in `wall.js` from `_updateContext` to `_enter` to compensate for above. * Fixes some tests that relied on tags being lazily released.
…de (#3759) * Restores eager release of tags for exported spans in `process_spans.js`. * Moves tag fetching in `wall.js` from `_updateContext` to `_enter` to compensate for above. * Fixes some tests that relied on tags being lazily released.
…de (#3759) * Restores eager release of tags for exported spans in `process_spans.js`. * Moves tag fetching in `wall.js` from `_updateContext` to `_enter` to compensate for above. * Fixes some tests that relied on tags being lazily released.
…de (#3759) * Restores eager release of tags for exported spans in `process_spans.js`. * Moves tag fetching in `wall.js` from `_updateContext` to `_enter` to compensate for above. * Fixes some tests that relied on tags being lazily released.
…de (DataDog#3759) * Restores eager release of tags for exported spans in `process_spans.js`. * Moves tag fetching in `wall.js` from `_updateContext` to `_enter` to compensate for above. * Fixes some tests that relied on tags being lazily released.
What does this PR do?
Restores eager releasing of tags for finished and exported spans. Since this also affects the way wall profiler can compute endpoints, that code needs to be adapted as well.
Motivation
Reports of too high memory pressure since we removed eager cleaning of tags.
Additional Notes
The implementation is much simpler than that in #3755. It eschews complications that were merely performance optimizations: release of tags held by sampling context when the span ends, and reduction of work for repeated lookup of web spans for a single span. This is the minimal code change necessary to keep operating correctly in face of restored eager tag release in
span_processor.js
.Security
Datadog employees:
@DataDog/security-design-and-guidance
.