Skip to content

Commit 57d5ca2

Browse files
committed
設定の記述場所が変わったらしい?ようなwarnが出たので修正
関連してそう getsentry/sentry-javascript#12044 あとedgeは必要無いので削除。ビルドwarnが出なければそのままでヨシ
1 parent 6e22f49 commit 57d5ca2

File tree

3 files changed

+31
-43
lines changed

3 files changed

+31
-43
lines changed

app/instrumentation.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import * as Sentry from "@sentry/nextjs";
2+
import { appenv } from "./lib/envvars";
3+
4+
const dsn =
5+
"https://53f5a903731e07e39ea32248e65c6a22@o4506720064962560.ingest.sentry.io/4506819121709056";
6+
7+
export function register() {
8+
if (process.env.NEXT_RUNTIME === "nodejs") {
9+
const environment = appenv();
10+
Sentry.init({
11+
dsn,
12+
environment,
13+
enabled: environment !== "local",
14+
15+
tracesSampler: (ctx) => {
16+
// MEMO: ctx.requestもctx.locationも何故か値が入らない
17+
const isRecordRequest =
18+
ctx.transactionContext.name === "POST /record/[slug]";
19+
if (isRecordRequest) {
20+
// recordは毎分1リクエストありquotaを圧迫するため、stgは記録せずprdも数を減らす。
21+
// rateを0.1にすれば、月4,300程度/quota 10,000 に収まる
22+
return environment === "staging" ? 0 : 0.1;
23+
}
24+
25+
// その他のリクエストは全て記録
26+
return 1;
27+
},
28+
});
29+
}
30+
// MEMO: edge環境は想定していない
31+
}

app/sentry.edge.config.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

app/sentry.server.config.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)