-
Notifications
You must be signed in to change notification settings - Fork 837
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
refactor(sdk-trace-base): remove _registeredSpanProcessors
from BasicTracerProvider
#5177
refactor(sdk-trace-base): remove _registeredSpanProcessors
from BasicTracerProvider
#5177
Conversation
_registeredSpanProcessors
from BasicTracerProvider_registeredSpanProcessors
from BasicTracerProvider
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #5177 +/- ##
==========================================
- Coverage 93.15% 93.14% -0.02%
==========================================
Files 315 315
Lines 8113 8106 -7
Branches 1633 1633
==========================================
- Hits 7558 7550 -8
- Misses 555 556 +1
|
@@ -97,10 +97,8 @@ export class SpanImpl implements Span { | |||
private readonly _startTimeProvided: boolean; | |||
|
|||
/** | |||
* Constructs a new Span instance. | |||
* | |||
* @deprecated calling Span constructor directly is not supported. Please use tracer.startSpan. |
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.
note to reviewer: this is a leftover from #5048. The class is now internal and used in Tracer
} | ||
|
||
this.activeSpanProcessor = new MultiSpanProcessor(spanProcessors); |
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.
note to reviewer: forceFlush
method was only iterating over the _registeredSpanProcessors
. So when using the default exporter and processor (the else case) the BatchSpanProcessor.forceFlush
method was never called. I've added a test for it
@@ -779,6 +834,29 @@ describe('BasicTracerProvider', () => { | |||
}); | |||
|
|||
describe('.forceFlush()', () => { | |||
it('should call forceFlush with the default processor', done => { |
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.
note for reviewer: this is the test to check that with exporter/processor defined from env the forceFlush
method is called.
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.
looks good, thank you 🙌
Which problem is this PR solving?
After merging #5152 it is not necessary to have
_registeredSpanProcessors
private property to modify at runtime. This PR does remove the property and adapts the tests.Fixes #5136
Short description of the changes
_registeredSpanProcessors
fromBasicTracerProvider
forceFlush
works in all situations.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Checklist: