Skip to content

Commit

Permalink
Add new Lambda X-Ray samples (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
joe4dev authored Sep 15, 2023
1 parent 54f20f0 commit 6577b88
Show file tree
Hide file tree
Showing 24 changed files with 492 additions and 9,069 deletions.
42 changes: 4 additions & 38 deletions lambda-xray/Makefile
Original file line number Diff line number Diff line change
@@ -1,41 +1,7 @@
export AWS_ACCESS_KEY_ID ?= test
export AWS_SECRET_ACCESS_KEY ?= test
export AWS_DEFAULT_REGION=us-east-1

usage: ## Show this help
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

install: ## Install dependencies
@npm install
@which serverless || npm install -g serverless
@which localstack || pip install localstack
@which awslocal || pip install awscli-local

run: ## Deploy the app locally and run a Lambda test invocation
echo "Deploying Serverless app to local environment"; \
SLS_DEBUG=1 npm run deploy && \
echo "Serverless app successfully deployed. Now invoking the Lambda function to generate XRay traces." && \
awslocal lambda invoke --function-name test-xray-local-hello /tmp/out.tmp; \
TIME=$$(date +%s); \
ID=$$(awslocal xray get-trace-summaries --start-time $$(($$TIME-120)) --end-time $$TIME | jq -r '.TraceSummaries[0].Id'); \
awslocal xray batch-get-traces --trace-ids $$ID

start:
localstack start -d

stop:
@echo
localstack stop
ready:
@echo Waiting on the LocalStack container...
@localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1)

logs:
@localstack logs > logs.txt
for-each-dir:
../make-for-each.sh $$MAKE_TARGET $$CMD

test-ci:
make start install ready run; return_code=`echo $$?`;\
make logs; make stop; exit $$return_code;

.PHONY: usage install start run stop ready logs test-ci
MAKE_TARGET='test-ci' make for-each-dir

.PHONY: for-each-dir test-ci
72 changes: 0 additions & 72 deletions lambda-xray/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions lambda-xray/config.yml

This file was deleted.

18 changes: 0 additions & 18 deletions lambda-xray/handler.js

This file was deleted.

Loading

0 comments on commit 6577b88

Please sign in to comment.