Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ static void exit(

try {
final AgentSpan span = scope.span();
if (throwable != null) {
span.addThrowable(throwable);
}
span.finish();
AgentTracer.get().notifyExtensionEnd(span, result, null != throwable);
} finally {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
import java.io.InputStream;
import java.io.OutputStream;

public class HandlerStreamingWithError implements RequestStreamHandler {
@Override
public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) {
throw new Error("Some error");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,40 @@ abstract class LambdaHandlerInstrumentationTest extends VersionedNamingTestBase
}
}
}

def "test streaming handler with error"() {
when:
def input = new ByteArrayInputStream(StandardCharsets.UTF_8.encode("Hello").array())
def output = new ByteArrayOutputStream()
new HandlerStreamingWithError().handleRequest(input, output, null)

then:
thrown(Error)
assertTraces(1) {
trace(1) {
span {
operationName operation()
errored true
tags {
tag "error.type", "java.lang.Error"
tag "error.message", "Some error"
tag "error.stack", String
tag "language", "jvm"
tag "process_id", Long
tag "runtime-id", String
tag "thread.id", Long
tag "thread.name", String
tag "_dd.profiling.ctx", "test"
tag "_dd.profiling.enabled", 0
tag "_dd.agent_psr", 1.0
tag "_dd.tracer_host", String
tag "_sample_rate", 1
tag "_dd.trace_span_attribute_schema", { it != null }
}
}
}
}
}
}


Expand Down
Loading