Skip to content

Commit fc8d09b

Browse files
committed
close span on exception handling in pekko test server
1 parent e541864 commit fc8d09b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

dd-java-agent/instrumentation/pekko-http-1.0/src/baseTest/scala/PekkoHttpTestWebServer.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ object PekkoHttpTestWebServer {
136136
private val exceptionHandler = ExceptionHandler {
137137
case e: Exception =>
138138
val span = activeSpan()
139-
TraceUtils.handleException(span, e)
139+
if (span != null) {
140+
// The exception handler is bypassing the normal instrumentation flow, so we need to handle things here
141+
TraceUtils.handleException(span, e)
142+
span.finish()
143+
}
140144
complete(
141145
HttpResponse(status = EXCEPTION.getStatus, entity = e.getMessage)
142146
)

0 commit comments

Comments
 (0)