⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
fix(sentry/alerts): add resolution condition + drop tokenized query params
justin45c4ab25e55f
diff --git a/scripts/provision-sentry-alerts.sh b/scripts/provision-sentry-alerts.shindex b4778741c..f488509e6 100755--- a/scripts/provision-sentry-alerts.sh+++ b/scripts/provision-sentry-alerts.sh@@ -59,13 +59,6 @@ ficommand -v jq >/dev/null || { err "jq is required"; exit 1; }# ---- API helpers -----# URL-encode a value for use in a query string. Slugs and alert names with-# spaces, colons, or other reserved chars would otherwise break the GET-# endpoints (HTTP 000 with curl).-url_encode() {- printf '%s' "$1" | jq -sRr @uri-}-# Run an API call. Prints response body on success, returns 0.# On HTTP >= 400, prints the response body to stderr and returns 1.api_call() {@@ -102,12 +95,21 @@ api_call() {rm -f "$tmp"}+# Sentry's `?query=` parameter is tokenized (e.g. `is:unresolved`, `project:foo`),+# not free-text. Names like "Kaneo API: New issue" parse as broken search tokens.+# Easier to fetch all and filter client-side: at most ~10 alerts in this org.+list_workflows() {+ api_call GET "${API_BASE}/organizations/${ORG}/workflows/"+}++list_monitors() {+ api_call GET "${API_BASE}/organizations/${ORG}/monitors/"+}+find_existing_workflow_id() {local name="$1"- local encoded- encoded=$(url_encode "$name")local response- response=$(api_call GET "${API_BASE}/organizations/${ORG}/workflows/?query=${encoded}") || return 0+ response=$(list_workflows) || return 0echo "$response" | jq -r --arg name "$name" \'.[] | select(.name == $name) | .id' | head -n1}@@ -184,14 +186,13 @@ for i in $(seq 0 $((COUNT - 1))); doif [ "$HAS_SLUGS" = "true" ]; thenSLUGS=$(echo "$ALERT" | jq -r '.detector_slugs[]')+ RESP=$(list_monitors) || {+ err "Monitor lookup failed for '$NAME'"+ ERRORS=$((ERRORS + 1))+ continue+ }RESOLVED=()for slug in $SLUGS; do- encoded=$(url_encode "$slug")- RESP=$(curl -sS -H "Authorization: Bearer ${SENTRY_API_TOKEN}" \- "${API_BASE}/organizations/${ORG}/monitors/?query=${encoded}" 2>/dev/null) || {- err "Monitor lookup failed for '$slug'"- continue- }id=$(echo "$RESP" | jq -r --arg slug "$slug" \'.[] | select(.slug == $slug) | .id' | head -n1)if [ -z "$id" ] || [ "$id" = "null" ]; thendiff --git a/sentry/alerts.json b/sentry/alerts.jsonindex 49c0ead46..344f7bffd 100644--- a/sentry/alerts.json+++ b/sentry/alerts.json@@ -58,6 +58,11 @@"type": "gt","comparison": 50,"conditionResult": 75+ },+ {+ "type": "lte",+ "comparison": 50,+ "conditionResult": 0}],"actions": []@@ -114,6 +119,11 @@"type": "gt","comparison": 1500,"conditionResult": 50+ },+ {+ "type": "lte",+ "comparison": 1500,+ "conditionResult": 0}],"actions": []@@ -154,6 +164,11 @@"type": "gt","comparison": 0.05,"conditionResult": 75+ },+ {+ "type": "lte",+ "comparison": 0.05,+ "conditionResult": 0}],"actions": []