The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
feat: better erroring in shop (#248)
narrow-adventureca2f966dacda
diff --git a/testing/shop/backend/coupon.go b/testing/shop/backend/coupon.goindex 105e72e9..bb830042 100644--- a/testing/shop/backend/coupon.go+++ b/testing/shop/backend/coupon.go@@ -12,7 +12,7 @@ import ("github.com/gin-gonic/gin")-var couponHits = map[string]int{}+var couponHits map[string]intfunc applyCoupon(c *gin.Context) {ctx := c.Request.Context()@@ -44,12 +44,6 @@ func applyCoupon(c *gin.Context) {couponHits[req.Code]++- if !fastPath() {- traceway.CaptureExceptionWithContext(ctx, traceway.NewStackTraceErrorf("coupon service timeout while applying %s", req.Code))- c.JSON(http.StatusInternalServerError, gin.H{"error": "could not apply coupon, please try again"})- return- }-total := cartTotal(ctx, twdb)discount := total * percentOff / 100c.JSON(http.StatusOK, gin.H{diff --git a/testing/shop/demo-traffic.sh b/testing/shop/demo-traffic.shindex dbae3038..a7e2f536 100755--- a/testing/shop/demo-traffic.sh+++ b/testing/shop/demo-traffic.sh@@ -42,7 +42,7 @@ printf ' '; for i in $(seq 1 18); do printf '%s ' "$(timed GET /api/products)";echo "== 2. Slow product detail, N+1 + recommendations span (#2) =="printf ' '; for id in 1 2 3 4 5 6 7 8; do printf 'id%s=%s ' "$id" "$(timed GET "/api/products/$id")"; done; echo-echo "== 3. Coupon nil-map PANIC (#5) — POST /api/coupon SAVE10, ~75% -> 500 =="+echo "== 3. Coupon nil-map PANIC (#5) — POST /api/coupon SAVE10, every call -> 500 =="codes=""; for i in $(seq 1 12); do codes+="$(hit POST /api/coupon '{"code":"SAVE10"}') "; doneecho " $codes"echo " -> $(grep -o 500 <<<"$codes" | wc -l | tr -d ' ')/12 panicked (assignment to entry in nil map)"