make startto spin up our application with LocalStack. This will take a couple of minutes, but once it’s completed, we’ll have our API running inside the LocalStack container.
THUNDRA_APIKEYas an environment variable and you are good to go with application monitoring. To enable Foresight as well,
THUNDRA_AGENT_TEST_PROJECT_IDenvironment variable must be set.
Makefile. If that’s done, let’s run the tests with
make test. After some time, if the demo gods are with us and we don’t have any problem, we should be able to see the results.
FINISHEDstate in our collection. Let’s check Foresight and then click to our test to see if we can see what went wrong.
Trace Mapbutton on the top right, it’ll open a window and will automatically redirect you to your invocations trace map. Here, we can see the whole flow, identical to what we’ve designed at the beginning of this post. We will also be able to tell where the error comes from.
AmazonDynamoDBExceptionand a message that says everything fails. Let’s click on that up-arrow and see what’s the source of this.
addRequestmethod has failed when saving the item into our DynamoDB database. Let’s see our trace map again. If we click the JUnit 5 node on our map, we’ll see the whole trace chart for our test.
getResponselist doesn’t have the
FINISHEDstate as expected.
KINESIS_ERROR_PROBABILITY=0.8. But let’s not go into too much detail here - we’ll cover that in a separate blog post!
LocalStackTest.javafile, you’d see that we’re calling
make start-embeddedbefore each test. We’re simply forwarding all the Lambda invocations to the built-in Lambda server inside Thundra Agent. With this configuration, your cold starts and deployment time decreases substantially.