-
Notifications
You must be signed in to change notification settings - Fork 580
Expand file tree
/
Copy pathinstrumentation-client.ts
More file actions
41 lines (32 loc) · 1.59 KB
/
Copy pathinstrumentation-client.ts
File metadata and controls
41 lines (32 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// This file configures the initialization of Sentry on the client.
// The added config here will be used whenever a users loads a page in their browser.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import * as Sentry from "@sentry/nextjs";
import { resolveSentryDsn, isCommunityDsn, integracoesDoCliente } from "./lib/sentry/dsn";
import { sentryScrubHooks } from "./lib/sentry/scrub";
const sentryDsn = resolveSentryDsn(
typeof window !== "undefined" ? window.__PUBLIC_ENV__?.SENTRY_DSN : undefined,
);
const community = isCommunityDsn(sentryDsn);
Sentry.init({
dsn: sentryDsn,
// FORMA DE FUNÇÃO, não de array: array SOMA aos defaults do SDK, e era assim
// que a `BrowserSession` (default) seguia ligada apesar da política abaixo. A
// função RECEBE os defaults e o retorno os substitui — é o único jeito de tirar
// uma integração default sem enumerar as outras dez à mão.
integrations: (padraoDoSdk) => [
...integracoesDoCliente(padraoDoSdk, community),
Sentry.replayIntegration(),
],
// No Sentry da comunidade, só erro (issue #100): sem trace, sem replay de
// sessão e sem sessão de release health (ver integracoesDoCliente). O replay DE
// ERRO continua, porque é o que explica o stack trace — e o replayIntegration()
// sem argumentos já aplica maskAllText/blockAllMedia.
tracesSampleRate: community ? 0 : 1,
enableLogs: true,
replaysSessionSampleRate: community ? 0 : 0.1,
replaysOnErrorSampleRate: 1.0,
sendDefaultPii: false,
...sentryScrubHooks,
});
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;