Skip to content

Instantly share code, notes, and snippets.

@wildcard
Created January 30, 2021 11:27
Show Gist options
  • Save wildcard/578847687558d4a6e0daf77c19124153 to your computer and use it in GitHub Desktop.
Save wildcard/578847687558d4a6e0daf77c19124153 to your computer and use it in GitHub Desktop.
sentry bitbar plugin bash implementation
#!/usr/bin/env bash
SERVICE=""
ISSUE_COUNT=5
ORG=""
PROJECT_URL="https://app.getsentry.com/$ORG/$SERVICE"
TOKEN=""
echo "Sentry"
echo "---"
echo "$ORG / $SERVICE @ Sentry | href=$PROJECT_URL"
echo "---"
curl -s -X GET \
"https://sentry.io/api/0/projects/${ORG}/${SERVICE}/issues/?query=is%3Aunresolved&limit=${ISSUE_COUNT}&sort=date&statsPeriod=24h" \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ${TOKEN}" |
/usr/local/bin/jq -r '
def statusColor($issue): if $issue.status == "resolved" or $issue.status == "muted" then
"green"
elif $issue.status == "unresolved" and (isempty($issue.assignedTo) | not) then
"orange"
else
"red"
end;
.[] |
"\(.title) | length=72 href=\(.permalink) size=11 color=\(statusColor(.))",
"Fields: | size=10",
"--Status: \(.status) | size=10",
"--Last Seen: \(.lastSeen) | size=10",
"--First Seen: \(.firstSeen) | size=10",
"--Occurrences: \(.count) | size=10",
"\(.culprit) | length=72 size=10",
"",
"---",
""
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment