Spaces:
Sleeping
Sleeping
File size: 957 Bytes
2e3e9b8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
#!/usr/bin/env bash
set -euo pipefail
BASE=${BASE:-http://localhost:8000}
API="$BASE/api/v1"
# Send a few successful queries to populate basic metrics
for q in \
"List all artists" \
"Top 5 albums by sales" \
"Count customers"
do
curl -s -X POST "$API/nl2sql" \
-H 'Content-Type: application/json' \
-d "{\"query\":\"$q\"}" >/dev/null || true
done
# Send queries that trigger safety and verifier checks
curl -s -X POST "$API/nl2sql" \
-H 'Content-Type: application/json' \
-d '{"query":"DELETE FROM users;"}' >/dev/null || true
curl -s -X POST "$API/nl2sql" \
-H 'Content-Type: application/json' \
-d '{"query":"SELECT COUNT(*), country FROM customers;"}' >/dev/null || true
# Print a snapshot of key Prometheus metrics
echo -e "\n--- Metrics snapshot ---"
curl -s "$BASE/metrics" | grep -E \
'stage_duration_ms_(sum|count|bucket)|pipeline_runs_total|safety_(checks|blocks)_total|verifier_(checks|failures)_total' \
|| true
|