Use when working with Sentry — sentry error tracking, performance monitoring, release health, and issue management. Covers error investigation, stack trace analysis, release comparison, performance transaction monitoring, alert rule management, and issue triage workflows. Use when investigating application errors, analyzing crash rates, reviewing release health, or managing Sentry projects.
Investigate errors, monitor performance, and manage issues in Sentry.
Always discover organizations, projects, and issue IDs before querying specifics.
#!/bin/bash
sentry_api() {
local endpoint="$1"
curl -s -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
"https://sentry.io/api/0/${endpoint}"
}
echo "=== Organizations ==="
sentry_api "organizations/" | jq -r '.[] | "\(.slug)\t\(.name)\t\(.features | length) features"' | column -t
echo ""
echo "=== Projects ==="
sentry_api "organizations/${SENTRY_ORG:-your-org}/projects/" \
| jq -r '.[] | "\(.slug)\t\(.platform // "unknown")\t\(.status)"' | column -t
echo ""
echo "=== Teams ==="
sentry_api "organizations/${SENTRY_ORG:-your-org}/teams/" \
| jq -r '.[] | "\(.slug)\t\(.name)\t\(.memberCount) members"' | column -t
#!/bin/bash
sentry_api() {
local method="${1:-GET}"
local endpoint="$2"
local data="${3:-}"
if [ -n "$data" ]; then
curl -s -X "$method" \
-H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
-H "Content-Type: application/json" \
"https://sentry.io/api/0/${endpoint}" \
-d "$data"
else
curl -s -X "$method" \
-H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
"https://sentry.io/api/0/${endpoint}"
fi
}
ORG="${SENTRY_ORG}"
jq to extract key fields only#!/bin/bash
ORG="$SENTRY_ORG"
PROJECT="${1:-}"
DAYS="${2:-7}"
QUERY_PARAMS="query=is:unresolved&limit=25&statsPeriod=${DAYS}d&sort=freq"
[ -n "$PROJECT" ] && QUERY_PARAMS="${QUERY_PARAMS}&project=${PROJECT}"
echo "=== Top Unresolved Issues ($DAYS days) ==="
sentry_api GET "organizations/${ORG}/issues/?${QUERY_PARAMS}" \
| jq -r '.[] | "\(.count)\t\(.level)\t\(.title[0:60])\t\(.project.slug)"' \
| sort -rn | column -t | head -20
echo ""
echo "=== Issues by Level ==="
sentry_api GET "organizations/${ORG}/issues/?query=is:unresolved&limit=100&statsPeriod=${DAYS}d" \
| jq -r '.[].level' | sort | uniq -c | sort -rn
echo ""
echo "=== New Issues This Week ==="
sentry_api GET "organizations/${ORG}/issues/?query=is:unresolved age:-7d&limit=20&sort=date" \
| jq -r '.[] | "\(.firstSeen[0:16])\t\(.level)\t\(.title[0:60])"' | column -t | head -15
#!/bin/bash
ISSUE_ID="${1:?Issue ID required}"
echo "=== Issue Details ==="
sentry_api GET "issues/${ISSUE_ID}/" | jq '{
id: .id,
title: .title,
culprit: .culprit,
level: .level,
status: .status,
count: .count,
userCount: .userCount,
firstSeen: .firstSeen,
lastSeen: .lastSeen,
project: .project.slug,
assignee: .assignedTo.name
}'
echo ""
echo "=== Latest Event Stack Trace ==="
sentry_api GET "issues/${ISSUE_ID}/events/latest/" \
| jq -r '
.entries[] |
select(.type == "exception") |
.data.values[] |
"\(.type): \(.value)\n" +
(.stacktrace.frames[-5:] | reverse | .[] | " \(.filename):\(.lineno) in \(.function)")
' 2>/dev/null | head -30
echo ""
echo "=== Affected Users ==="
sentry_api GET "issues/${ISSUE_ID}/tags/user/" \
| jq -r '.topValues[:10][] | "\(.count)\t\(.name)"' | sort -rn | column -t
#!/bin/bash
ORG="$SENTRY_ORG"
PROJECT="${1:?Project slug required}"
echo "=== Recent Releases ==="
sentry_api GET "organizations/${ORG}/releases/?project=${PROJECT}&limit=10" \
| jq -r '.[] | "\(.version[0:20])\t\(.dateCreated[0:16])\t\(.newGroups) new issues\t\(.healthData.stats // "N/A")"' \
| column -t
echo ""
echo "=== Release Crash Rate Comparison ==="
sentry_api GET "organizations/${ORG}/releases/?project=${PROJECT}&limit=5" \
| jq -r '
.[] |
"\(.version[0:20]): sessions=\(.totalSessions // 0) crashRate=\(.crashFreeRate // "N/A")"
' | head -10
echo ""
echo "=== Issues Introduced in Latest Release ==="
LATEST=$(sentry_api GET "organizations/${ORG}/releases/?project=${PROJECT}&limit=1" | jq -r '.[0].version')
echo "Release: $LATEST"
sentry_api GET "organizations/${ORG}/issues/?query=is:unresolved firstRelease:${LATEST}&limit=15" \
| jq -r '.[] | "\(.level)\t\(.count)\t\(.title[0:60])"' | column -t
#!/bin/bash
ORG="$SENTRY_ORG"
PROJECT="${1:?Project slug required}"
echo "=== Transaction Performance (P95) ==="
sentry_api GET "organizations/${ORG}/events/?project=${PROJECT}&field=transaction&field=p95()&field=count()&sort=-p95()&statsPeriod=24h&per_page=15" \
| jq -r '.data[] | "\(.transaction[0:50])\t\(."p95()" | . * 10 | round / 10)ms\t\(."count()" | tostring) reqs"' \
| column -t | head -15
echo ""
echo "=== Slowest Transactions ==="
sentry_api GET "organizations/${ORG}/events/?field=transaction&field=p99()&field=count()&sort=-p99()&statsPeriod=24h&per_page=10" \
| jq -r '.data[] | "\(.transaction[0:50])\tP99:\(."p99()" | . * 10 | round / 10)ms"' \
| column -t | head -10
echo ""
echo "=== Throughput Trend ==="
sentry_api GET "organizations/${ORG}/events-stats/?project=${PROJECT}&field=count()&statsPeriod=24h&interval=1h" \
| jq -r '.data[] | "\(.[0] | strftime("%H:00"))\t\(.[1][0].count)"' | head -24
#!/bin/bash
ORG="$SENTRY_ORG"
PROJECT="${1:?Project slug required}"
echo "=== Alert Rules ==="
sentry_api GET "projects/${ORG}/${PROJECT}/alert-rules/" \
| jq -r '.[] | "\(.name)\t\(.status)\t\(.triggers | length) triggers"' | column -t
echo ""
echo "=== Recent Alert Incidents ==="
sentry_api GET "organizations/${ORG}/incidents/?project=${PROJECT}&limit=10" \
| jq -r '.[] | "\(.dateStarted[0:16])\t\(.status)\t\(.title)"' | column -t | head -10
#!/bin/bash
ORG="$SENTRY_ORG"
echo "=== Unassigned High-Priority Issues ==="
sentry_api GET "organizations/${ORG}/issues/?query=is:unresolved !has:assignee level:error&limit=20&sort=freq" \
| jq -r '.[] | "\(.count)\t\(.project.slug)\t\(.title[0:60])"' \
| sort -rn | column -t | head -15
echo ""
echo "=== Issues Assigned to Me ==="
sentry_api GET "organizations/${ORG}/issues/?query=is:unresolved assigned:me&limit=20" \
| jq -r '.[] | "\(.status)\t\(.level)\t\(.title[0:60])"' | column -t | head -10
echo ""
echo "=== Regression Issues ==="
sentry_api GET "organizations/${ORG}/issues/?query=is:regression&limit=15&statsPeriod=7d" \
| jq -r '.[] | "\(.count)\t\(.level)\t\(.title[0:60])"' | sort -rn | column -t | head -10
#!/bin/bash
ORG="$SENTRY_ORG"
PROJECT="${1:?Project slug required}"
echo "=== Error Rate Trend (last 7 days, hourly) ==="
sentry_api GET "organizations/${ORG}/events-stats/?project=${PROJECT}&query=level:error&statsPeriod=7d&interval=6h" \
| jq -r '.data[] | "\(.[0] | strftime("%Y-%m-%d %H:%M"))\t\(.[1][0].count)"' | tail -28
echo ""
echo "=== Error Breakdown by Platform ==="
sentry_api GET "organizations/${ORG}/issues/?query=is:unresolved&limit=100&statsPeriod=7d" \
| jq -r '.[].project.platform // "unknown"' | sort | uniq -c | sort -rn | head -10
Present results as a structured report:
Monitoring Sentry Report
════════════════════════
Resources discovered: [count]
Resource Status Key Metric Issues
──────────────────────────────────────────────
[name] [ok/warn] [value] [findings]
Summary: [total] resources | [ok] healthy | [warn] warnings | [crit] critical
Action Items: [list of prioritized findings]
Target ≤50 lines of output. Use tables for multi-resource comparisons.
--help output.| Shortcut | Counter | Why |
|---|---|---|
| "I'll skip discovery and check known resources" | Always run Phase 1 discovery first | Resource names change, new resources appear — assumed names cause errors |
| "The user only asked for a quick check" | Follow the full discovery → analysis flow | Quick checks miss critical issues; structured analysis catches silent failures |
| "Default configuration is probably fine" | Audit configuration explicitly | Defaults often leave logging, security, and optimization features disabled |
| "Metrics aren't needed for this" | Always check relevant metrics when available | API/CLI responses show current state; metrics reveal trends and intermittent issues |
| "I don't have access to that" | Try the command and report the actual error | Assumed permission failures prevent useful investigation; actual errors are informative |
/issues/<id>/ after discovering from listsleep 0.2 between batch requestsproject_slug, others require org_slug — check carefullystatsPeriod format: Uses 7d, 24h, 1h format — not ISO dates for most endpointscursor header for next page — check Link response header/issues/<id>/events/ to see individual occurrences[-5:] to get most recent framessentry.io — adjust base URL accordingly