Merge pull request #9079 from tchak/chore-sentry-release
ETQ Opérateur, je voudrais que les erreurs dans Sentry soient liées à la version de l'application
This commit is contained in:
commit
68ca71314d
4 changed files with 19 additions and 3 deletions
|
@ -287,7 +287,8 @@ class ApplicationController < ActionController::Base
|
|||
enabled: sentry[:enabled],
|
||||
environment: sentry[:environment],
|
||||
browser: { modern: BrowserSupport.supported?(browser) },
|
||||
user: sentry_user
|
||||
user: sentry_user,
|
||||
release: SentryRelease.current
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -2,13 +2,14 @@ import * as Sentry from '@sentry/browser';
|
|||
import { getConfig } from '@utils';
|
||||
|
||||
const {
|
||||
sentry: { key, enabled, user, environment, browser }
|
||||
sentry: { key, enabled, user, environment, browser, release }
|
||||
} = getConfig();
|
||||
|
||||
// We need to check for key presence here as we do not have a dsn for browser yet
|
||||
if (enabled && key) {
|
||||
Sentry.init({
|
||||
dsn: key,
|
||||
release: release ?? undefined,
|
||||
environment,
|
||||
tracesSampleRate: 0.1,
|
||||
ignoreErrors: [
|
||||
|
|
|
@ -32,7 +32,8 @@ const Gon = z
|
|||
enabled: z.boolean().default(false),
|
||||
environment: z.string().optional(),
|
||||
user: z.object({ id: z.string() }).default({ id: '' }),
|
||||
browser: z.object({ modern: z.boolean() }).default({ modern: false })
|
||||
browser: z.object({ modern: z.boolean() }).default({ modern: false }),
|
||||
release: z.string().nullish()
|
||||
})
|
||||
.default({}),
|
||||
crisp: z
|
||||
|
|
|
@ -1,8 +1,21 @@
|
|||
class SentryRelease
|
||||
@@current = nil
|
||||
|
||||
def self.current
|
||||
@@current ||= begin
|
||||
version = Rails.root.join('version')
|
||||
version.readable? ? version.read.strip : ''
|
||||
end
|
||||
@@current.presence
|
||||
end
|
||||
end
|
||||
|
||||
Sentry.init do |config|
|
||||
secrets = Rails.application.secrets.sentry
|
||||
|
||||
config.dsn = secrets[:enabled] ? secrets[:rails_client_key] : nil
|
||||
config.send_default_pii = false
|
||||
config.release = SentryRelease.current
|
||||
config.environment = secrets[:environment] || Rails.env
|
||||
config.enabled_environments = ['production', secrets[:environment].presence].compact
|
||||
config.breadcrumbs_logger = [:active_support_logger]
|
||||
|
|
Loading…
Add table
Reference in a new issue