-
Notifications
You must be signed in to change notification settings - Fork 8
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
Flesh out synchronization of EmbraceSpan functionality #938
Conversation
|
||
synchronized(startedSpan) { | ||
val newSpan = spanBuilder.startSpan(attemptedStartTimeMs) | ||
if (newSpan.isRecording) { |
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.
This is the main change - If a newly started span is not actually recording, it means the underlying span is a non-recording one or has already been stopped (i.e. the wrapping span builder has already created the span and stopped it on another thread), so we fail the invocation of this wrapper call, first-writer-wins style. We do the same for stop()
|
||
@Before | ||
fun setup() { | ||
val initModule = FakeInitModule(clock) | ||
spanRepository = initModule.openTelemetryModule.spanRepository | ||
tracer = initModule.openTelemetryModule.tracer | ||
tracer = FakeTracer() |
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.
Changing the code to check whether the associated span is recording before returning that a start
call has succeeded means that if I used a real Tracer, it would find that the parent I had set is fake (and therefore the Context
object isn't populated), so it'll fail.
Since the goal for this is testing the unit, I'm going to use a fake in here instead so the implementation detail of another object doesn't affect the results of this test.
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.
LGTM
77a8c11
to
182a65f
Compare
983a316
to
949214f
Compare
182a65f
to
6a60660
Compare
949214f
to
b195268
Compare
6a60660
to
6224dc3
Compare
b195268
to
134fbf8
Compare
6224dc3
to
8389991
Compare
399544b
to
218d9bf
Compare
06d87c8
to
5692399
Compare
218d9bf
to
9ab80ce
Compare
5692399
to
ebdbfb2
Compare
9ab80ce
to
c545a69
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #938 +/- ##
==========================================
- Coverage 80.94% 80.91% -0.03%
==========================================
Files 444 444
Lines 11800 11802 +2
Branches 1802 1802
==========================================
- Hits 9551 9550 -1
- Misses 1456 1458 +2
- Partials 793 794 +1
|
c545a69
to
1f179b3
Compare
Goal
Flesh out synchronization of the wrapper EmbraceSpan given that we know the operations in the
SdkSpan
are synchronized already.