add sentry

This commit is contained in:
Pete Matsyburka committed 2024-05-23 12:25:25 +03:00
1 parent 2a75055fb6
commit 1405fefc85
7 files changed
+109 -3

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
import * as Sentry from '@sentry/browser'
const sentryDsn = document.querySelector('meta[name="sentry-dsn"]')?.getAttribute('content')
if (sentryDsn) {
Sentry.init({
dsn: sentryDsn,
beforeSend (event) {
if (event.request.url.match(/\/[ds]\/\w+$/)) {
event.request.url = event.request.url.slice(0, -6)
}
return event
}
})
}
+6 -1
View File
@@ -5,7 +5,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= javascript_pack_tag 'application', defer: true %>
<% if ENV['SENTRY_DSN'] %>
<meta name="sentry-dsn" content="<%= ENV.fetch('SENTRY_DSN', nil) %>">
<%= javascript_pack_tag 'sentry', 'application', defer: true %>
<% else %>
<%= javascript_pack_tag 'application', defer: true %>
<% end %>
<%= stylesheet_pack_tag 'application', media: 'all' %>
<%= render 'shared/posthog' if ENV['POSTHOG_TOKEN'] %>
<%= render 'shared/plausible' if !signed_in? && ENV['PLAUSIBLE_DOMAIN'] %>
+6 -1
View File
@@ -5,7 +5,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= javascript_pack_tag 'form', defer: true %>
<% if ENV['SENTRY_DSN'] %>
<meta name="sentry-dsn" content="<%= ENV.fetch('SENTRY_DSN', nil) %>">
<%= javascript_pack_tag 'sentry', 'form', defer: true %>
<% else %>
<%= javascript_pack_tag 'form', defer: true %>
<% end %>
<%= stylesheet_pack_tag 'form', media: 'all' %>
<%= render 'shared/posthog' if ENV['POSTHOG_TOKEN'] %>
</head>
+6 -1
View File
@@ -5,7 +5,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= javascript_pack_tag 'application', defer: true %>
<% if ENV['SENTRY_DSN'] %>
<meta name="sentry-dsn" content="<%= ENV.fetch('SENTRY_DSN', nil) %>">
<%= javascript_pack_tag 'sentry', 'application', defer: true %>
<% else %>
<%= javascript_pack_tag 'application', defer: true %>
<% end %>
<%= stylesheet_pack_tag 'application', media: 'all' %>
<%= render 'shared/posthog' if ENV['POSTHOG_TOKEN'] %>
</head>