Skip to content

Commit

Permalink
Added feedback and session profiling with sentry [PATCH]
Browse files Browse the repository at this point in the history
  • Loading branch information
onuratakan committed Feb 24, 2024
1 parent 14a3447 commit f49b5dd
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
36 changes: 36 additions & 0 deletions upsonic_on_prem/dash/app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,42 @@

{% include 'in_page_load.js.html' %}

{% sentry as sentry %}
{% sentry_dsn as sentry_dsn %}
{% if sentry %}

<!-- Recommended: Use this bundle for feedback, replay, error, and performance monitoring -->
<script
src="https://browser.sentry-cdn.com/7.102.1/bundle.tracing.replay.feedback.min.js"
integrity="sha384-26uTXIBpd3urK4WDZ68YL44GKxnla0zmZ8qlduExjd57i0bUcMZPL11G6tnCAEiH"
crossorigin="anonymous"
></script>
<script>
Sentry.setUser({
fullName: "{{request.user.username}}",
});
Sentry.init({
dsn: "{{sentry_dsn}}",

integrations: [
Sentry.feedbackIntegration({
// Additional SDK configuration goes in here, for example:
colorScheme: "dark",
useSentryUser: {
email: "email",
name: "fullName",
},
}),
Sentry.replayIntegration(),
],
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
});


</script>

{% endif %}


</head>
Expand Down
11 changes: 11 additions & 0 deletions upsonic_on_prem/dash/app/templatetags/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,14 @@
@register.simple_tag(name='debug_mode')
def debug_mode():
return settings.DEBUG


@register.simple_tag(name='sentry')
def sentry():

return settings.sentry

@register.simple_tag(name='sentry_dsn')
def sentry_dsn():

return settings.sentry_dsn
1 change: 1 addition & 0 deletions upsonic_on_prem/dash/dash/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

sentry = os.environ.get("sentry", "false").lower() == "true"
sentry_django_key = os.environ.get("sentry_django_key", "https://[email protected]/4506678631858176")
sentry_dsn = os.environ.get("sentry_dsn", "https://1040c5057fc1ad3bd322a800edf1aed2@o4506678585786368.ingest.sentry.io/4506678631858176")
# settings.py
if sentry:
import sentry_sdk
Expand Down

0 comments on commit f49b5dd

Please sign in to comment.