Skip to content

Commit 829c35b

Browse files
llama90claudegithub-advanced-security[bot]Copilot
authored
Add E2E Performance Tracking and Testing Infrastructure (#18)
Add comprehensive performance testing and E2E metrics tracking - Add Artillery load testing infrastructure with multiple test profiles (minimal/light/full) - Add E2E performance metrics: totalE2eMs, queueWaitMs, workerDurationMs, syncResponseMs, asyncResponseMs - Add CloudWatch Logs analysis scripts with performance breakdown - Add HTML report generation with charts and screenshot capture - Add error tracking to performance metrics - Fix analyze-performance.sh timestamp handling and CloudWatch query issues --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: llama90 <6668548+llama90@users.noreply.github.com>
1 parent 06d38e9 commit 829c35b

22 files changed

Lines changed: 4495 additions & 10 deletions

applications/chatops/slack-bot/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,10 @@ npm-debug.log*
3030

3131
# TypeScript
3232
*.tsbuildinfo
33+
34+
# Performance test results
35+
performance-tests/results/*.json
36+
performance-tests/results/*.html
37+
38+
# Environment files
39+
performance-tests/.env

applications/chatops/slack-bot/Makefile

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ help:
4848
@echo " make deploy-<component> - Upload to S3 → Deploy"
4949
@echo " make deploy-build - Deploy build worker from local (default)"
5050
@echo ""
51+
@echo "$(GREEN)Performance Testing:$(NC)"
52+
@echo " make perf-test - Run test (default: minimal ~1min)"
53+
@echo " Options: PROFILE=minimal|light|full"
54+
@echo " make perf-analyze - Analyze latest test results"
55+
@echo " make perf-analyze-quiet - Analyze (quiet mode, for CI/CD)"
56+
@echo " make perf-summary - Quick summary"
57+
@echo " make perf-report - Generate HTML report"
58+
@echo " make perf-capture - Capture HTML as screenshot"
59+
@echo " make perf-clean - Clean test results"
60+
@echo ""
5161
@echo "$(GREEN)Deploy Lambda (Advanced):$(NC)"
5262
@echo " make deploy-<component>-local - Deploy from local dist/ (fast, no upload)"
5363
@echo ""
@@ -224,3 +234,70 @@ clean-all: clean
224234
@echo "$(BLUE)Cleaning all dependencies...$(NC)"
225235
rm -rf node_modules
226236
@echo "$(GREEN)✓ Deep clean complete$(NC)"
237+
238+
# -----------------------------------------------------------------------------
239+
# Performance Testing
240+
# -----------------------------------------------------------------------------
241+
242+
# Test profile configuration
243+
PERF_PROFILE ?= minimal
244+
PERF_CONFIG_minimal = artillery-echo-minimal.yml
245+
PERF_CONFIG_light = artillery-echo-light.yml
246+
PERF_CONFIG_full = artillery-config.yml
247+
248+
perf-test-install:
249+
@if ! command -v artillery > /dev/null; then \
250+
echo "$(BLUE)Installing Artillery...$(NC)"; \
251+
npm install -g artillery artillery-plugin-metrics-by-endpoint; \
252+
fi
253+
@cd performance-tests && npm install --no-save @aws-sdk/client-ssm 2>/dev/null || true
254+
255+
perf-test: perf-test-install
256+
@echo "$(BLUE)Running performance test [$(PERF_PROFILE)]...$(NC)"
257+
@if [ -z "$(API_GATEWAY_URL)" ]; then \
258+
API_URL=$$(cd $(SANDBOX_ROOT)/slack-api-gateway && terragrunt output -raw api_gateway_url 2>/dev/null); \
259+
if [ -z "$$API_URL" ]; then \
260+
echo "$(YELLOW)✗ Could not get API Gateway URL$(NC)"; \
261+
echo "$(YELLOW) Set manually: API_GATEWAY_URL=https://xxx...$(NC)"; \
262+
exit 1; \
263+
fi; \
264+
else \
265+
API_URL=$(API_GATEWAY_URL); \
266+
fi; \
267+
CONFIG=$(PERF_CONFIG_$(PERF_PROFILE)); \
268+
export API_GATEWAY_URL=$$API_URL ENVIRONMENT=$(ENVIRONMENT) AWS_REGION=$(REGION); \
269+
cd performance-tests && artillery run $$CONFIG --output results/test-$$(date +%Y%m%d-%H%M%S).json
270+
271+
perf-analyze:
272+
@echo "$(BLUE)Analyzing latest test results...$(NC)"
273+
@cd performance-tests && ./analyze-performance.sh --from-test
274+
275+
perf-analyze-quiet:
276+
@cd performance-tests && ./analyze-e2e-json.sh 2>&1 | grep -E '(✓|Analyzing|Error)' || true
277+
278+
perf-summary:
279+
@LATEST=$$(ls -t performance-tests/results/*.json 2>/dev/null | grep -v '\.metrics\.json' | head -n1); \
280+
if [ -z "$$LATEST" ]; then echo "$(YELLOW)No results$(NC)"; exit 1; fi; \
281+
echo "$(GREEN)$$LATEST$(NC)"; \
282+
jq -r '"Requests: " + (.aggregate.counters["http.requests"] | tostring), \
283+
"P50: " + (.aggregate.summaries["http.response_time"].median | tostring) + "ms", \
284+
"P95: " + (.aggregate.summaries["http.response_time"].p95 | tostring) + "ms", \
285+
"Errors: " + ((.aggregate.counters["errors.total"] // 0) | tostring)' $$LATEST
286+
287+
perf-report:
288+
@LATEST=$$(ls -t performance-tests/results/*.json 2>/dev/null | grep -v '\.metrics\.json' | head -n1); \
289+
if [ -z "$$LATEST" ]; then echo "$(YELLOW)No results$(NC)"; exit 1; fi; \
290+
REPORT=$${LATEST%.json}.html; \
291+
node performance-tests/render-report.js $$LATEST $$REPORT; \
292+
echo "$(GREEN)✓ Report: $$REPORT$(NC)"
293+
294+
perf-capture:
295+
@LATEST=$$(ls -t performance-tests/results/*.html 2>/dev/null | head -n1); \
296+
if [ -z "$$LATEST" ]; then echo "$(YELLOW)No HTML report found$(NC)"; exit 1; fi; \
297+
OUTPUT=$${LATEST%.html}.png; \
298+
node performance-tests/capture-report.js $$LATEST $$OUTPUT; \
299+
echo "$(GREEN)✓ Screenshot: $$OUTPUT$(NC)"
300+
301+
perf-clean:
302+
@rm -rf performance-tests/results/*.json performance-tests/results/*.html performance-tests/results/*.png
303+
@echo "$(GREEN)✓ Cleaned$(NC)"

0 commit comments

Comments
 (0)