Skip to content

Commit

Permalink
設定の記述場所が変わったらしい?ようなwarnが出たので修正
Browse files Browse the repository at this point in the history
関連してそう getsentry/sentry-javascript#12044
あとedgeは必要無いので削除。ビルドwarnが出なければそのままでヨシ
  • Loading branch information
cumet04 committed Jun 16, 2024
1 parent 6e22f49 commit 57d5ca2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 43 deletions.
31 changes: 31 additions & 0 deletions app/instrumentation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import * as Sentry from "@sentry/nextjs";
import { appenv } from "./lib/envvars";

const dsn =
"https://53f5a903731e07e39ea32248e65c6a22@o4506720064962560.ingest.sentry.io/4506819121709056";

export function register() {
if (process.env.NEXT_RUNTIME === "nodejs") {
const environment = appenv();
Sentry.init({
dsn,
environment,
enabled: environment !== "local",

tracesSampler: (ctx) => {
// MEMO: ctx.requestもctx.locationも何故か値が入らない
const isRecordRequest =
ctx.transactionContext.name === "POST /record/[slug]";
if (isRecordRequest) {
// recordは毎分1リクエストありquotaを圧迫するため、stgは記録せずprdも数を減らす。
// rateを0.1にすれば、月4,300程度/quota 10,000 に収まる
return environment === "staging" ? 0 : 0.1;
}

// その他のリクエストは全て記録
return 1;
},
});
}
// MEMO: edge環境は想定していない
}
18 changes: 0 additions & 18 deletions app/sentry.edge.config.ts

This file was deleted.

25 changes: 0 additions & 25 deletions app/sentry.server.config.ts

This file was deleted.

0 comments on commit 57d5ca2

Please sign in to comment.