Met à jour l'intégration sentry avec l'instance de beta.gouv.fr

pull/1522/head
Johan Girod 2021-05-03 13:28:31 +02:00
parent 06220dbcbc
commit a62d3e2d95
9 changed files with 161 additions and 99 deletions

View File

@ -29,8 +29,8 @@
"@types/js-yaml": "^3.12.2",
"@types/react": "^17.0.0",
"@types/react-color": "^3.0.1",
"@types/react-helmet": "^6.1.0",
"@types/react-dom": "^17.0.0",
"@types/react-helmet": "^6.1.0",
"@types/react-redux": "^7.1.11",
"@types/react-router": "^5.1.2",
"@types/recharts": "^1.8.16",
@ -62,7 +62,8 @@
"@babel/runtime": "^7.3.4",
"@react-pdf/renderer": "^1.6.10",
"@rehooks/local-storage": "^2.1.1",
"@sentry/browser": "5.15.5",
"@sentry/react": "^6.3.5",
"@sentry/tracing": "^6.3.5",
"classnames": "^2.2.5",
"color-convert": "^1.9.2",
"core-js": "^3.2.1",
@ -93,7 +94,6 @@
"recharts": "^1.8.5",
"reduce-reducers": "^1.0.4",
"redux": "^4.0.4",
"redux-sentry-middleware": "^0.1.8",
"regenerator-runtime": "^0.13.3",
"reselect": "^4.0.0",
"styled-components": "^5.1.0",

View File

@ -1,4 +1,3 @@
import * as Sentry from '@sentry/browser'
import Footer from 'Components/layout/Footer/Footer'
import Header from 'Components/layout/Header'
import Route404 from 'Components/Route404'
@ -16,7 +15,6 @@ import { Helmet } from 'react-helmet'
import { useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
import { Route, Switch } from 'react-router-dom'
import createSentryMiddleware from 'redux-sentry-middleware'
import {
configSituationSelector,
situationSelector,
@ -45,28 +43,6 @@ import {
} from './storage/persistInFranceApp'
import { setupSimulationPersistence } from './storage/persistSimulation'
if (process.env.NODE_ENV === 'production') {
let branch: string | undefined = process.env.GITHUB_REF?.split('/')?.slice(
-1
)?.[0]
if (branch === 'merge') {
branch = process.env.GITHUB_HEAD_REF
}
const release =
branch && `${branch}-` + process.env.GITHUB_SHA?.substring(0, 7)
const dsn = 'https://9051375f856646d694943532caf2b45f@sentry.data.gouv.fr/18'
Sentry.init({ dsn, release })
if (branch && branch !== 'master') {
console.log(
` Vous êtes sur la branche : %c${branch}`,
'font-weight: bold; text-decoration: underline;'
)
}
}
const middlewares = [createSentryMiddleware(Sentry as any)]
type RootProps = {
basename: ProviderProps['basename']
rules: Rules
@ -80,7 +56,6 @@ export default function Root({ basename, rules }: RootProps) {
<Provider
basename={basename}
sitePaths={paths}
reduxMiddlewares={middlewares}
onStoreCreated={(store) => {
setupInFranceAppPersistence(store)
setupSimulationPersistence(store)

View File

@ -1,3 +1,4 @@
import { ErrorBoundary } from '@sentry/react'
import { ThemeColorsProvider } from 'Components/utils/colors'
import { SitePathProvider, SitePaths } from 'Components/utils/SitePathsContext'
import { createBrowserHistory } from 'history'
@ -18,6 +19,7 @@ import {
// ATInternet Tracking
import { TrackingContext } from './ATInternetTracking'
import { createTracker } from './ATInternetTracking/Tracker'
import logo from './static/images/logo.svg'
import safeLocalStorage from './storage/safeLocalStorage'
import { inIframe } from './utils'
@ -118,29 +120,53 @@ export default function Provider({
) ?? undefined
return (
// If IE < 11 display nothing
<ReduxProvider store={store}>
<ThemeColorsProvider
color={iframeCouleur && decodeURIComponent(iframeCouleur)}
>
<TrackingContext.Provider
value={
new ATTracker({
language: i18next.language as 'fr' | 'en',
})
}
<ErrorBoundary
showDialog
fallback={
<>
<div className="ui__ container">
<img
src={logo}
style={{ maxWidth: '200px', width: '100%', marginTop: '1rem' }}
></img>
<h1>Une erreur est survenue</h1>
<p>
L'équipe technique de mon-entreprise.fr a été automatiquement
prévenue. Vous pouvez également nous contacter directement à
l'adresse{' '}
<a href="mailto:contact@mon-entreprise.beta.gouv.fr">
contact@mon-entreprise.beta.gouv.fr
</a>{' '}
si vous souhaitez partager une remarque.
</p>
<p>Veuillez nous excuser pour la gêne occasionnée.</p>
</div>
</>
}
>
<ReduxProvider store={store}>
<ThemeColorsProvider
color={iframeCouleur && decodeURIComponent(iframeCouleur)}
>
<SiteNameContext.Provider value={basename}>
<SitePathProvider value={sitePaths}>
<I18nextProvider i18n={i18next}>
<Router history={history}>
<>{children}</>
</Router>
</I18nextProvider>
</SitePathProvider>
</SiteNameContext.Provider>
</TrackingContext.Provider>
</ThemeColorsProvider>
</ReduxProvider>
<TrackingContext.Provider
value={
new ATTracker({
language: i18next.language as 'fr' | 'en',
})
}
>
<SiteNameContext.Provider value={basename}>
<SitePathProvider value={sitePaths}>
<I18nextProvider i18n={i18next}>
<Router history={history}>
<>{children}</>
</Router>
</I18nextProvider>
</SitePathProvider>
</SiteNameContext.Provider>
</TrackingContext.Provider>
</ThemeColorsProvider>
</ReduxProvider>
</ErrorBoundary>
)
}

View File

@ -40,7 +40,6 @@ export default function TargetSelection({ showPeriodSwitch = true }) {
(state: RootState) => state.simulation?.config.objectifs || []
)
const colors = useContext(ThemeColorsContext)
return (
<div id="targetSelection">
{((typeof objectifs[0] === 'string'

View File

@ -8,6 +8,7 @@ import i18next from './locales/i18n'
import ruleTranslations from './locales/rules-en.yaml'
import translateRules from './locales/translateRules'
import translations from './locales/ui-en.yaml'
import './sentry'
i18next.addResourceBundle('en', 'translation', translations)
i18next.changeLanguage('en')

View File

@ -6,6 +6,7 @@ import { hot } from 'react-hot-loader/root'
import 'regenerator-runtime/runtime'
import App from './App'
import i18next from './locales/i18n'
import './sentry'
i18next.changeLanguage('fr')

View File

@ -0,0 +1,29 @@
import * as Sentry from '@sentry/react'
import { Integrations } from '@sentry/tracing'
let branch: string | undefined = process.env.GITHUB_REF?.split('/')?.slice(
-1
)?.[0]
if (branch === 'merge') {
branch = process.env.GITHUB_HEAD_REF
}
const release = branch && `${branch}-` + process.env.GITHUB_SHA?.substring(0, 7)
if (branch && branch !== 'master') {
console.info(
` Vous êtes sur la branche : %c${branch}`,
'font-weight: bold; text-decoration: underline;'
)
}
Sentry.init({
dsn:
'https://92bbc21937b24136a2fe1b1d922b000f@o548798.ingest.sentry.io/5745615',
integrations: [new Integrations.BrowserTracing()],
release,
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 0.5,
})

View File

@ -1,9 +1,22 @@
// TODO: The webpack configuration of the publi.codes site remains in the
// mon-entreprise.fr and should be dissociated.
import * as Sentry from '@sentry/react'
import { Integrations } from '@sentry/tracing'
import 'core-js/stable'
import { render } from 'react-dom'
import 'regenerator-runtime/runtime'
import App from './components/App'
Sentry.init({
dsn:
'https://92bbc21937b24136a2fe1b1d922b000f@o548798.ingest.sentry.io/5745615',
integrations: [new Integrations.BrowserTracing()],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 0.5,
})
const anchor = document.querySelector('#js')
render(<App />, anchor)

112
yarn.lock
View File

@ -2047,14 +2047,14 @@
dependencies:
any-observable "^0.3.0"
"@sentry/browser@5.15.5":
version "5.15.5"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.15.5.tgz#d9a51f1388581067b50d30ed9b1aed2cbb333a36"
integrity sha512-rqDvjk/EvogfdbZ4TiEpxM/lwpPKmq23z9YKEO4q81+1SwJNua53H60dOk9HpRU8nOJ1g84TMKT2Ov8H7sqDWA==
"@sentry/browser@6.3.5":
version "6.3.5"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.3.5.tgz#fc89538cf73752cd5b10060a914c6c5ece2d2893"
integrity sha512-fjkhPR5gLCGVWhbWjEoN64hnmTvfTLRCgWmYTc9SiGchWFoFEmLqZyF2uJFyt27+qamLQ9fN58nnv4Ly2yyxqg==
dependencies:
"@sentry/core" "5.15.5"
"@sentry/types" "5.15.5"
"@sentry/utils" "5.15.5"
"@sentry/core" "6.3.5"
"@sentry/types" "6.3.5"
"@sentry/utils" "6.3.5"
tslib "^1.9.3"
"@sentry/browser@^5.0.0":
@ -2067,17 +2067,6 @@
"@sentry/utils" "5.27.6"
tslib "^1.9.3"
"@sentry/core@5.15.5":
version "5.15.5"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.15.5.tgz#40ea79bff5272d3fbbeeb4a98cdc59e1adbd2c92"
integrity sha512-enxBLv5eibBMqcWyr+vApqeix8uqkfn0iGsD3piKvoMXCgKsrfMwlb/qo9Ox0lKr71qIlZVt+9/A2vZohdgnlg==
dependencies:
"@sentry/hub" "5.15.5"
"@sentry/minimal" "5.15.5"
"@sentry/types" "5.15.5"
"@sentry/utils" "5.15.5"
tslib "^1.9.3"
"@sentry/core@5.27.6":
version "5.27.6"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.27.6.tgz#3ceeb58acd857f1e17d52d3087bfecb506adc1f7"
@ -2089,13 +2078,15 @@
"@sentry/utils" "5.27.6"
tslib "^1.9.3"
"@sentry/hub@5.15.5":
version "5.15.5"
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.15.5.tgz#f5abbcdbe656a70e2ff02c02a5a4cffa0f125935"
integrity sha512-zX9o49PcNIVMA4BZHe//GkbQ4Jx+nVofqU/Il32/IbwKhcpPlhGX3c1sOVQo4uag3cqd/JuQsk+DML9TKkN0Lw==
"@sentry/core@6.3.5":
version "6.3.5"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.3.5.tgz#6b73de736eb9d0040be94cdbb06a744cd6b9172e"
integrity sha512-VR2ibDy33mryD0mT6d9fGhKjdNzS2FSwwZPe9GvmNOjkyjly/oV91BKVoYJneCqOeq8fyj2lvkJGKuupdJNDqg==
dependencies:
"@sentry/types" "5.15.5"
"@sentry/utils" "5.15.5"
"@sentry/hub" "6.3.5"
"@sentry/minimal" "6.3.5"
"@sentry/types" "6.3.5"
"@sentry/utils" "6.3.5"
tslib "^1.9.3"
"@sentry/hub@5.27.6":
@ -2107,13 +2098,13 @@
"@sentry/utils" "5.27.6"
tslib "^1.9.3"
"@sentry/minimal@5.15.5":
version "5.15.5"
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.15.5.tgz#a0e4e071f01d9c4d808094ae7203f6c4cca9348a"
integrity sha512-zQkkJ1l9AjmU/Us5IrOTzu7bic4sTPKCatptXvLSTfyKW7N6K9MPIIFeSpZf9o1yM2sRYdK7GV08wS2eCT3JYw==
"@sentry/hub@6.3.5":
version "6.3.5"
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.3.5.tgz#c5bc6760f7e4e53e87149703b106804299060389"
integrity sha512-ZYFo7VYKwdPVjuV9BDFiYn+MpANn6eZMz5QDBfZ2dugIvIVbuOyOOLx8PSa3ZXJoVTZZ7s2wD2fi/ZxKjNjZOQ==
dependencies:
"@sentry/hub" "5.15.5"
"@sentry/types" "5.15.5"
"@sentry/types" "6.3.5"
"@sentry/utils" "6.3.5"
tslib "^1.9.3"
"@sentry/minimal@5.27.6":
@ -2125,23 +2116,47 @@
"@sentry/types" "5.27.6"
tslib "^1.9.3"
"@sentry/types@5.15.5":
version "5.15.5"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.15.5.tgz#16c97e464cf09bbd1d2e8ce90d130e781709076e"
integrity sha512-F9A5W7ucgQLJUG4LXw1ZIy4iLevrYZzbeZ7GJ09aMlmXH9PqGThm1t5LSZlVpZvUfQ2rYA8NU6BdKJSt7B5LPw==
"@sentry/minimal@6.3.5":
version "6.3.5"
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.3.5.tgz#ef4894771243d01d81e91819400d2ecdcb34b411"
integrity sha512-4RqIGAU0+8iI/1sw0GYPTr4SUA88/i2+JPjFJ+qloh5ANVaNwhFPRChw+Ys9xpre8LV9JZrEsEf8AvQr4fkNbA==
dependencies:
"@sentry/hub" "6.3.5"
"@sentry/types" "6.3.5"
tslib "^1.9.3"
"@sentry/react@^6.3.5":
version "6.3.5"
resolved "https://registry.yarnpkg.com/@sentry/react/-/react-6.3.5.tgz#a2942b46601f1f0f1b37f176079eac7ab8d6cb49"
integrity sha512-BBxZeUBVOaDYGgoXi51Kocm9VQ2sIsftECh77m/3bZHBKOJDwpC+aoGI47vCtvWqzhL+6f2Zn1wNi1UhDqu7Aw==
dependencies:
"@sentry/browser" "6.3.5"
"@sentry/minimal" "6.3.5"
"@sentry/types" "6.3.5"
"@sentry/utils" "6.3.5"
hoist-non-react-statics "^3.3.2"
tslib "^1.9.3"
"@sentry/tracing@^6.3.5":
version "6.3.5"
resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.3.5.tgz#f76c362159141f860081ec7df80aa9f85b545860"
integrity sha512-TNKAST1ge2g24BlTfVxNp4gP5t3drbi0OVCh8h8ah+J7UjHSfdiqhd9W2h5qv1GO61gGlpWeN/TyioyQmOxu0Q==
dependencies:
"@sentry/hub" "6.3.5"
"@sentry/minimal" "6.3.5"
"@sentry/types" "6.3.5"
"@sentry/utils" "6.3.5"
tslib "^1.9.3"
"@sentry/types@5.27.6":
version "5.27.6"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.27.6.tgz#b5054eafcb8ac11d4bc4787c7bc7fc113cad8b80"
integrity sha512-XOW9W8DrMk++4Hk7gWi9o5VR0o/GrqGfTKyFsHSIjqt2hL6kiMPvKeb2Hhmp7Iq37N2bDmRdWpM5m+68S2Jk6w==
"@sentry/utils@5.15.5":
version "5.15.5"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.15.5.tgz#dec1d4c79037c4da08b386f5d34409234dcbfb15"
integrity sha512-Nl9gl/MGnzSkuKeo3QaefoD/OJrFLB8HmwQ7HUbTXb6E7yyEzNKAQMHXGkwNAjbdYyYbd42iABP6Y5F/h39NtA==
dependencies:
"@sentry/types" "5.15.5"
tslib "^1.9.3"
"@sentry/types@6.3.5":
version "6.3.5"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.3.5.tgz#d5eca7e76c250882ab78c01a8df894a9a9ca537d"
integrity sha512-tY/3pkAmGYJ3F0BtwInsdt/uclNvF8aNG7XHsTPQNzk7BkNVWjCXx0sjxi6CILirl5nwNxYxVeTr2ZYAEZ/dSQ==
"@sentry/utils@5.27.6":
version "5.27.6"
@ -2151,6 +2166,14 @@
"@sentry/types" "5.27.6"
tslib "^1.9.3"
"@sentry/utils@6.3.5":
version "6.3.5"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.3.5.tgz#a4805448cb0314d3d119688162aa695598a10bbb"
integrity sha512-kHUcZ37QYlNzz7c9LVdApITXHaNmQK7+sw/If3M/qpff1fd5XoecA8laLfcYuz+Cw5mRhVmdhPcCRM3Xi1IGXg==
dependencies:
"@sentry/types" "6.3.5"
tslib "^1.9.3"
"@sinonjs/commons@^1", "@sinonjs/commons@^1.6.0", "@sinonjs/commons@^1.7.0", "@sinonjs/commons@^1.8.1":
version "1.8.1"
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.1.tgz#e7df00f98a203324f6dc7cc606cad9d4a8ab2217"
@ -7171,7 +7194,7 @@ hmac-drbg@^1.0.1:
minimalistic-assert "^1.0.0"
minimalistic-crypto-utils "^1.0.1"
hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0:
hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
@ -11489,11 +11512,6 @@ reduce-reducers@^1.0.4:
resolved "https://registry.yarnpkg.com/reduce-reducers/-/reduce-reducers-1.0.4.tgz#fb77e751a9eb0201760ac5a605ca8c9c2d0537f8"
integrity sha512-Mb2WZ2bJF597exiqX7owBzrqJ74DHLK3yOQjCyPAaNifRncE8OD0wFIuoMhXxTnHK07+8zZ2SJEKy/qtiyR7vw==
redux-sentry-middleware@^0.1.8:
version "0.1.8"
resolved "https://registry.yarnpkg.com/redux-sentry-middleware/-/redux-sentry-middleware-0.1.8.tgz#29f71821c1fb87d4ebcb8f76067fea3c3738a64c"
integrity sha512-xubpYH9RgE31tZUESeRW5agwQa19Yd6Gy+4iO09raW/2TITPO5fhJdXpVwJfpGMbIYhEmHFqE2wD5Lnz7YtAeA==
redux@>=3.7.2, redux@^4.0.0, redux@^4.0.4:
version "4.0.5"
resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.5.tgz#4db5de5816e17891de8a80c424232d06f051d93f"