Query Sentry for errors and bugs. Unresolved issues, stacktraces, error trends, environment breakdowns, and issue details.
Query the self-hosted Sentry instance for bugs and errors. Sentry runs on Server 2 (sentry.sonno.tech) but the API is reachable from any server.
SENTRY_TOKEN=$(grep SENTRY_AUTH_TOKEN .env.production | cut -d= -f2)
SENTRY_API="https://sentry.sonno.tech/api/0"
SENTRY_PROJECT="$SENTRY_API/projects/sentry/alive"
SENTRY_ISSUES="$SENTRY_API/issues"
AUTH="Authorization: Bearer $SENTRY_TOKEN"
IMPORTANT: The Sentry API uses Bearer token auth and returns JSON. The queries below use inline Python via python3 -c for simplicity. For more complex queries, consider using temp files to avoid shell quoting issues.
Key endpoints:
$SENTRY_PROJECT/issues/ — list/search issues$SENTRY_ISSUES/{id}/events/$SENTRY_PROJECT/stats/ — time-series error countsWhen the user asks about Sentry errors, run ALL of these in parallel to give a full picture. Adjust statsPeriod (24h, 14d) based on what the user asks.
Top bugs sorted by how often they occur.
curl -s "$SENTRY_PROJECT/issues/?query=is:unresolved&sort=freq&limit=15&statsPeriod=14d" \
-H "$AUTH" | python3 -c "
import sys, json
d = json.load(sys.stdin)
print(f"{'Count':>6} {'Users':>5} {'Level':>5} Title")
print('-' * 80)
for issue in d:
title = issue['title'][:55]
print(f'{issue[\"count\"]:>6} {issue[\"userCount\"]:>5} {issue[\"level\"]:>5} {title}')
print(f' Last: {issue[\"lastSeen\"][:19]} {issue[\"permalink\"]}')
"
Freshly appearing errors — regressions or new bugs.
curl -s "$SENTRY_PROJECT/issues/?query=is:unresolved&sort=date&limit=10&statsPeriod=24h" \
-H "$AUTH" | python3 -c "
import sys, json
d = json.load(sys.stdin)
if not d:
print('No new issues in the last 24h.')