-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1778 from navikt/faro
Ta i bruk Faro for observability i web klient
- Loading branch information
Showing
4 changed files
with
173 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import 'core-js/stable'; | ||
import 'regenerator-runtime/runtime'; | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { createRoot } from 'react-dom/client'; | ||
import * as Sentry from '@sentry/react'; | ||
import 'whatwg-fetch'; | ||
import environment, { gittMiljo } from './utils/environment'; | ||
import '@navikt/ds-css'; | ||
import Pages from './Pages/Pages'; | ||
import * as SentryTypes from '@sentry/types'; | ||
import { injectDecoratorClientSide } from '@navikt/nav-dekoratoren-moduler'; | ||
import { initializeFaro } from '@grafana/faro-web-sdk'; | ||
|
||
window.localStorage.removeItem('ForebyggeFraværInfoBoksLukket'); | ||
window.localStorage.removeItem('InntektsmeldingUndersøkelse'); | ||
|
@@ -25,6 +23,18 @@ class SentryDebugTransport implements SentryTypes.Transport { | |
} | ||
} | ||
|
||
initializeFaro({ | ||
url: gittMiljo({ | ||
prod: 'https://telemetry.nav.no/collect', | ||
dev: 'https://telemetry.ekstern.dev.nav.no/collect', | ||
other: '/collect', | ||
}), | ||
app: { | ||
name: 'min-side-arbeidsgiver', | ||
version: environment.GIT_COMMIT, | ||
}, | ||
}); | ||
|
||
Sentry.init({ | ||
dsn: 'https://[email protected]/27', | ||
release: environment.GIT_COMMIT, | ||
|
@@ -73,28 +83,6 @@ Sentry.init({ | |
transport: SentryDebugTransport, | ||
}, | ||
}), | ||
ignoreErrors: [ | ||
'Error: Failed to fetch', | ||
'TypeError: Failed to fetch', | ||
'Error: NetworkError when attempting to fetch resource.', | ||
'TypeError: NetworkError when attempting to fetch resource.', | ||
'Error: Load failed', | ||
'TypeError: Load failed', | ||
'Error: cancelled', | ||
'TypeError: cancelled', | ||
'Error: avbrutt', | ||
'TypeError: avbrutt', | ||
'Error: cancelado', | ||
'TypeError: cancelado', | ||
'Error: anulowane', | ||
'TypeError: anulowane', | ||
'Error: avbruten', | ||
'TypeError: avbruten', | ||
'Error: anulat', | ||
'TypeError: anulat', | ||
'Error: The operation was aborted.', | ||
'AbortError: The operation was aborted.', | ||
], | ||
}); | ||
|
||
injectDecoratorClientSide({ | ||
|
@@ -111,7 +99,8 @@ injectDecoratorClientSide({ | |
}, | ||
}).catch(Sentry.captureException); | ||
|
||
ReactDOM.render( | ||
const root = createRoot(document.getElementById('app')!); | ||
root.render( | ||
gittMiljo({ | ||
prod: <Pages />, | ||
other: ( | ||
|
@@ -120,6 +109,5 @@ ReactDOM.render( | |
<Pages />{' '} | ||
</React.StrictMode> | ||
), | ||
}), | ||
document.getElementById('root') | ||
}) | ||
); |