mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
Zulip already has integrations for server-side Sentry integration; however, it has historically used the Zulip-specific `blueslip` library for monitoring browser-side errors. However, the latter sends errors to email, as well optionally to an internal `#errors` stream. While this is sufficient for low volumes of users, and useful in that it does not rely on outside services, at higher volumes it is very difficult to do any analysis or filtering of the errors. Client-side errors are exceptionally noisy, with many false positives due to browser extensions or similar, so determining real real errors from a stream of un-grouped emails or messages in a stream is quite difficult. Add a client-side Javascript sentry integration. To provide useful backtraces, this requires extending the pre-deploy hooks to upload the source-maps to Sentry. Additional keys are added to the non-public API of `page_params` to control the DSN, realm identifier, and sample rates.
53 lines
1.8 KiB
Bash
Executable File
53 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Arguments: OLD_COMMIT NEW_COMMIT ...where both are `git describe`
|
|
# output or tag names. The CWD will be the new deploy directory.
|
|
|
|
set -e
|
|
set -u
|
|
|
|
if ! grep -q 'SENTRY_DSN' /etc/zulip/settings.py; then
|
|
echo "sentry: No DSN configured! Set SENTRY_DSN in /etc/zulip/settings.py"
|
|
exit 0
|
|
fi
|
|
|
|
if ! SENTRY_AUTH_TOKEN=$(crudini --get /etc/zulip/zulip-secrets.conf secrets sentry_release_auth_token); then
|
|
echo "sentry: No release auth token set! Set sentry_release_auth_token in /etc/zulip/zulip-secrets.conf"
|
|
exit 0
|
|
fi
|
|
|
|
if ! SENTRY_ORG=$(crudini --get /etc/zulip/zulip.conf sentry organization); then
|
|
echo "sentry: No organization set! Set sentry.organization in /etc/zulip/zulip.conf"
|
|
exit 0
|
|
fi
|
|
|
|
SENTRY_PROJECT=$(crudini --get /etc/zulip/zulip.conf sentry project)
|
|
SENTRY_FRONTEND_PROJECT=$(crudini --get /etc/zulip/zulip.conf sentry frontend_project)
|
|
if [ -z "$SENTRY_PROJECT" ] && [ -z "$SENTRY_FRONTEND_PROJECT" ]; then
|
|
echo "sentry: No project set! Set sentry.project and/or sentry.frontend_project in /etc/zulip/zulip.conf"
|
|
exit 0
|
|
fi
|
|
|
|
if ! which sentry-cli >/dev/null; then
|
|
echo "sentry: No sentry-cli installed!"
|
|
exit 0
|
|
fi
|
|
|
|
if ! [ -f ./sentry-release ]; then
|
|
echo "sentry: No Sentry sentry-release file found!"
|
|
exit 0
|
|
fi
|
|
|
|
SENTRY_RELEASE=$(cat ./sentry-release)
|
|
|
|
ENVIRONMENT=$(crudini --get /etc/zulip/zulip.conf machine deploy_type || echo "development")
|
|
|
|
echo "sentry: Adding deploy of '$ENVIRONMENT' and finalizing release"
|
|
|
|
export SENTRY_AUTH_TOKEN
|
|
sentry-cli releases --org="$SENTRY_ORG" deploys "$SENTRY_RELEASE" new \
|
|
--env "$ENVIRONMENT" \
|
|
--started "$(stat -c %Y ./sentry-release)" \
|
|
--finished "$(date +%s)" \
|
|
--name "$(hostname --fqdn)"
|
|
sentry-cli releases --org="$SENTRY_ORG" finalize "$SENTRY_RELEASE"
|