⚡ 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 missing API fields and URL-encode GET params
justine43550ffff0e
diff --git a/scripts/provision-sentry-alerts.sh b/scripts/provision-sentry-alerts.shindex 6846a690f..b4778741c 100755--- a/scripts/provision-sentry-alerts.sh+++ b/scripts/provision-sentry-alerts.sh@@ -59,6 +59,13 @@ 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() {@@ -84,10 +91,10 @@ api_call() {-H "Content-Type: application/json" \"${body_args[@]}" \"$url" 2>/dev/null) || {- err "HTTP $status from $method $url"+ err "HTTP ${status:-?} from $method $url"err "Request body: $body"err "Response body:"- sed 's/^/ /' "$tmp" >&2+ [ -s "$tmp" ] && sed 's/^/ /' "$tmp" >&2 || echo " (empty)" >&2rm -f "$tmp"return 1}@@ -97,8 +104,10 @@ api_call() {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=${name}") || return 0+ response=$(api_call GET "${API_BASE}/organizations/${ORG}/workflows/?query=${encoded}") || return 0echo "$response" | jq -r --arg name "$name" \'.[] | select(.name == $name) | .id' | head -n1}@@ -177,8 +186,9 @@ for i in $(seq 0 $((COUNT - 1))); doSLUGS=$(echo "$ALERT" | jq -r '.detector_slugs[]')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=${slug}" 2>/dev/null) || {+ "${API_BASE}/organizations/${ORG}/monitors/?query=${encoded}" 2>/dev/null) || {err "Monitor lookup failed for '$slug'"continue}diff --git a/sentry/alerts.json b/sentry/alerts.jsonindex 0a8b7e219..49c0ead46 100644--- a/sentry/alerts.json+++ b/sentry/alerts.json@@ -1,9 +1,12 @@{- "version": 1,+ "version": 2,"organization": "kaneo","region": "de","api_base": "https://de.sentry.io/api/0","_comment_actions": "Actions are intentionally minimal. After the script applies this config, configure per-alert notifications in the Sentry UI (Settings > Alerts). Recommended: Slack #engineering or email on-call.",+ "_comment_condition_result": "The Sentry API requires `conditionResult` on every condition. For issue alerts it's a boolean (true fires). For metric alerts it maps to issue priority: 75 = high, 50 = low, 0 = resolved.",+ "_comment_event_types": "dataSources need `eventTypes`. Errors: [\"default\", \"error\"]. Transactions: [\"trace_item_span\"].",+ "_comment_condition_group": "Detectors need a top-level `conditionGroup` defining the threshold (gt/lte/anomaly_detection).","alerts": [{"name": "Kaneo API: New issue",@@ -15,10 +18,14 @@"enabled": true,"triggers": {"logicType": "any-short",- "conditions": [{ "type": "first_seen_event", "comparison": true }],- "actions": []- },- "actionFilters": []+ "conditions": [+ {+ "type": "first_seen_event",+ "comparison": true,+ "conditionResult": true+ }+ ]+ }}},{@@ -37,23 +44,28 @@{"dataset": "events","query": "event.type:error",- "queryType": 1,+ "queryType": 0,"aggregate": "count()","timeWindow": 300,- "environment": "production"+ "environment": "production",+ "eventTypes": ["default", "error"]}],- "workflows": []+ "conditionGroup": {+ "logicType": "any",+ "conditions": [+ {+ "type": "gt",+ "comparison": 50,+ "conditionResult": 75+ }+ ],+ "actions": []+ }},"workflow": {"name": "Kaneo API: New error spike",- "enabled": true,- "triggers": {- "logicType": "any-short",- "conditions": [{ "type": "gt", "comparison": 50 }],- "actions": []- },- "actionFilters": []+ "enabled": true}},{@@ -69,18 +81,7 @@"_comment_detector_slugs": "Slugs are the human-readable identifiers from the captureCheckIn calls. The provisioning script resolves these to numeric detector IDs via GET /api/0/organizations/{org}/monitors/.","workflow": {"name": "Cron: missed check-in (any)",- "enabled": true,- "triggers": {- "logicType": "any-short",- "conditions": [- {- "type": "monitor_check_in_failure",- "comparison": true- }- ],- "actions": []- },- "actionFilters": []+ "enabled": true}},{@@ -102,20 +103,25 @@"queryType": 1,"aggregate": "p95(transaction.duration)","timeWindow": 600,- "environment": "production"+ "environment": "production",+ "eventTypes": ["trace_item_span"]}],- "workflows": []+ "conditionGroup": {+ "logicType": "any",+ "conditions": [+ {+ "type": "gt",+ "comparison": 1500,+ "conditionResult": 50+ }+ ],+ "actions": []+ }},"workflow": {"name": "Kaneo API: Slow p95 latency",- "enabled": true,- "triggers": {- "logicType": "any-short",- "conditions": [{ "type": "gt", "comparison": 1500 }],- "actions": []- },- "actionFilters": []+ "enabled": true}},{@@ -137,20 +143,25 @@"queryType": 1,"aggregate": "failure_rate()","timeWindow": 3600,- "environment": "production"+ "environment": "production",+ "eventTypes": ["trace_item_span"]}],- "workflows": []+ "conditionGroup": {+ "logicType": "any",+ "conditions": [+ {+ "type": "gt",+ "comparison": 0.05,+ "conditionResult": 75+ }+ ],+ "actions": []+ }},"workflow": {"name": "Kaneo API: MCP error rate",- "enabled": true,- "triggers": {- "logicType": "any-short",- "conditions": [{ "type": "gt", "comparison": 0.05 }],- "actions": []- },- "actionFilters": []+ "enabled": true}},{@@ -163,10 +174,14 @@"enabled": true,"triggers": {"logicType": "any-short",- "conditions": [{ "type": "first_seen_event", "comparison": true }],- "actions": []- },- "actionFilters": []+ "conditions": [+ {+ "type": "first_seen_event",+ "comparison": true,+ "conditionResult": true+ }+ ]+ }}}]