Skip to content

Commit

Permalink
tests clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
lmolkova committed Oct 5, 2021
1 parent 38afb0b commit 733ad17
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ package io.opentelemetry.instrumentation.reactor
import io.opentelemetry.api.GlobalOpenTelemetry
import io.opentelemetry.api.trace.Span
import io.opentelemetry.api.trace.SpanKind
import io.opentelemetry.api.trace.StatusCode
import io.opentelemetry.context.Context
import io.opentelemetry.instrumentation.test.LibraryTestTrait
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
Expand Down Expand Up @@ -126,18 +128,17 @@ class ReactorCoreTest extends AbstractReactorCoreTest implements LibraryTestTrai
.doOnEach({ signal ->
if (signal.isOnError()) {
// reactor 3.1 does not support getting context here yet
Span.current().setStatus(status)
Span.current().setStatus(StatusCode.ERROR)
Span.current().end()
} else if (signal.isOnComplete()) {
Span.current().end()
}
})
.subscriberContext({ ctx ->

io.opentelemetry.context.Context parent =
TracingOperator.fromContextOrDefault(ctx, io.opentelemetry.context.Context.current())
def parent = TracingOperator.fromContextOrDefault(ctx, Context.current())

Span innerSpan = GlobalOpenTelemetry.getTracer("test")
def innerSpan = GlobalOpenTelemetry.getTracer("test")
.spanBuilder(spanName)
.setParent(parent)
.startSpan()
Expand All @@ -152,7 +153,7 @@ class ReactorCoreTest extends AbstractReactorCoreTest implements LibraryTestTrai
} else if (publisher instanceof Flux) {
return Flux.just("")
} else {
throw new IllegalStateException("Unknown publisher: " + publisher)
throw new IllegalStateException("Unknown publisher")
}
}
}

0 comments on commit 733ad17

Please sign in to comment.