cd ~/environment/serverless-observability-workshop/code/sample-app-tracing
sam build
sam deploy
To invoke our API’s, we first need to fetch the ApiUrl
output variable that our CloudFormation stack gives us. So let us iterate through our stack and export all output variables as environment variables:
export ApiUrl=$(aws cloudformation describe-stacks --stack-name monitoring-app-tracing --output json | jq '.Stacks[].Outputs[] | select(.OutputKey=="ApiUrl") | .OutputValue' | sed -e 's/^"//' -e 's/"$//')
echo "export ApiUrl="$ApiUrl
Put Item
operationcurl -X POST \
$ApiUrl/items/ \
-d '{
"id":"5",
"name": "Fifth test item"
}'
curl -X POST \
$ApiUrl/items/ \
-d '{
"id":"6",
"name": "Sixth test item"
}'
Get All Items
operationcurl -X GET $ApiUrl/items/ | jq
Get Item by Id
operationcurl -X GET $ApiUrl/items/5 | jq
curl -X GET $ApiUrl/items/6 | jq
Go to ServiceLens Traces page.
Scroll down the Filter type list. You are now able to visualize the three different annotations we created as additional filters for your traces.
This time, you will be able to see the additional subsegments we created are now appearing with its respective response times.
Segment details
area. You should be able to see the custom annotations you added inside that subsegment.Segment details
area. You should be able to see the custom metadata you added inside that subsegment.Spare a couple minutes to analyze the Service Map and Traces for the Get Item By Id and Get All Items as well.