fixing Trace Bullet
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PING_SERVICE_URL=${PING_SERVICE_URL:-http://localhost:8082}
|
||||
GATEWAY_URL=${GATEWAY_URL:-http://localhost:8081}
|
||||
|
||||
check_metrics() {
|
||||
local url="$1"
|
||||
echo "[Smoke] Checking Prometheus metrics at $url ..."
|
||||
local body
|
||||
body=$(curl -sf "$url/actuator/prometheus") || return 1
|
||||
echo "$body" | grep -E 'http_server_requests|jvm_memory_used_bytes' -q
|
||||
}
|
||||
|
||||
if check_metrics "$PING_SERVICE_URL"; then
|
||||
echo "[Smoke][OK] ping-service exposes Prometheus metrics"
|
||||
else
|
||||
echo "[Smoke][FAIL] ping-service Prometheus endpoint not available" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if check_metrics "$GATEWAY_URL"; then
|
||||
echo "[Smoke][OK] api-gateway exposes Prometheus metrics"
|
||||
else
|
||||
echo "[Smoke][FAIL] api-gateway Prometheus endpoint not available" >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
GATEWAY_URL=${GATEWAY_URL:-http://localhost:8081}
|
||||
ZIPKIN_URL=${ZIPKIN_URL:-http://localhost:9411}
|
||||
|
||||
echo "[Smoke] Triggering ping via Gateway..."
|
||||
curl -sf "$GATEWAY_URL/api/ping/ping" > /dev/null || {
|
||||
echo "[Smoke][FAIL] Gateway ping failed" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Give Zipkin a moment to receive spans
|
||||
sleep 1
|
||||
|
||||
echo "[Smoke] Checking for recent traces in Zipkin..."
|
||||
TRACES_JSON=$(curl -sf "$ZIPKIN_URL/api/v2/traces?limit=5") || {
|
||||
echo "[Smoke][FAIL] Zipkin API not reachable" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Very lightweight check: ensure at least one trace contains api-gateway or ping-service
|
||||
if echo "$TRACES_JSON" | grep -E 'api-gateway|ping-service' -q; then
|
||||
echo "[Smoke][OK] Traces found for api-gateway/ping-service"
|
||||
exit 0
|
||||
else
|
||||
echo "[Smoke][WARN] No traces for api-gateway/ping-service in the last results" >&2
|
||||
# Not a hard failure; Zipkin may be delayed. Exit non-zero to be strict in CI
|
||||
exit 2
|
||||
fi
|
||||
Reference in New Issue
Block a user