Skip to content

Commit

Permalink
GITC-105: Sentry update (#9224)
Browse files Browse the repository at this point in the history
* update sentry backend

* set sentry options

* indent
  • Loading branch information
octavioamu authored Jun 30, 2021
1 parent 60c01a9 commit 3bb4d64
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 25 deletions.
2 changes: 1 addition & 1 deletion app/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def callback(request):
SENTRY_DSN = env.str('SENTRY_DSN', default='')
SENTRY_JS_DSN = env.str('SENTRY_JS_DSN', default=SENTRY_DSN)
RELEASE = raven.fetch_git_sha(os.path.abspath(os.pardir)) if ENV == 'prod' else ''
RAVEN_JS_VERSION = env.str('RAVEN_JS_VERSION', default='3.26.4')
RAVEN_JS_VERSION = env.str('RAVEN_JS_VERSION', default='6.8.0')
if SENTRY_DSN:
sentry_sdk.init(
SENTRY_DSN,
Expand Down
32 changes: 21 additions & 11 deletions app/app/templates/shared/sentry.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,22 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% if raven_js_dsn %}
<script src="https://cdn.ravenjs.com/{{ raven_js_version|default_if_none:'3.26.4' }}/raven.min.js" ></script>
<script
src="https://browser.sentry-cdn.com/{{ raven_js_version }}/bundle.min.js"
integrity="sha384-a1zd+NHj/GIqnlXIHuEKFontqYxBdK9Zwslrvnhr1KfU9tBDzKbM55gQFXlHYDiD"
crossorigin="anonymous"
></script>

<script>
var ravenOptions = {
release: '{{ release }}',

Sentry.init({
dsn: "{{ raven_js_dsn }}",
// this assumes your build process sets "npm_package_version" in the env
release: "gitcoin-web@{{ release }}",
environment: '{{ env }}',
// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0,
ignoreErrors: [
// Random plugins/extensions
'top.GLOBALS',
Expand All @@ -43,7 +54,7 @@
// See http://toolbar.conduit.com/Developer/HtmlAndGadget/Methods/JSInjection.aspx
'conduitPage'
],
ignoreUrls: [
denyUrls: [
// Facebook flakiness
/graph\.facebook\.com/i,
// Facebook blocked
Expand All @@ -59,14 +70,13 @@
/webappstoolbarba\.texthelp\.com\//i,
/metrics\.itunes\.apple\.com\.edgesuite\.net\//i
]
};
Raven.config('{{ raven_js_dsn }}', ravenOptions).install()
{% if github_handle %}
Raven.setUserContext({
id: '{{ user.id|default_if_none:"0" }}',
handle: '{{ github_handle }}',
profile_id: '{{ profile_id|default_if_none:"0" }}'
});
{% if github_handle %}
Sentry.setUser({
username: '{{ github_handle }}',
id: {{ user.id|default_if_none:"0" }}
});
Sentry.setTag("profile_id", {{ profile_id|default_if_none:"0" }});
{% endif %}
</script>
{% endif %}
12 changes: 0 additions & 12 deletions app/retail/templates/error.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,4 @@ <h1>{% blocktrans %}Error {{code}}.{% endblocktrans %}</h1>
{% endblocktrans %}</p>
<img class="mt-4" style="max-width: 22rem;" src="{% static "v2/images/shrug_bot.png" %}">
{% endif %}
{% comment %}
{% if code == 500 and request.sentry.id %}
{% load raven %}
<script src="https://cdn.ravenjs.com/{{ raven_js_version }}/raven.min.js"></script>
<script>
Raven.showReportDialog({
eventId: '{{ request.sentry.id }}',
dsn: '{% sentry_public_dsn "https" %}'
});
</script>
{% endif %}
{% endcomment %}
{% endblock %}
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ redis-semaphore
watchtower==0.5.4
Wand==0.4.4
raven==6.9.0
sentry-sdk==0.19.5
sentry-sdk==1.1.0
websocket-client
bleach
python-magic
Expand Down

0 comments on commit 3bb4d64

Please sign in to comment.