chore: Sentry SDK を v11 に上げ、Import Queue の metrics() の回避を外す - #184
Merged
Merged
Conversation
@sentry/cloudflare 11.0.0 で withSentry が包んだ Queue のメソッドを本物に結び直すようになった (getsentry/sentry-javascript#24592)ので、cron は handler の env から Queue を読む形に戻す。 - Worker: body を止めるための httpServerIntegration の上書きを外す。v11 は httpBodies を見る - Web: dataCollection.userInfo を false にする。v11 の既定では Sentry が IP を推定する - withSentry の型推論に合わせ、handler を ExportedHandler の変数にしてから渡す - v11 は isolate で client を 1 つだけ作るので、テストの transport をファイルで 1 つにする
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
#181 では、
withSentryが env の Queue を Proxy で包み、本物に結び直すのがsend/sendBatchだけだったため、cron のIMPORT_QUEUE.metrics()が Illegal invocation で落ちた。報告した getsentry/sentry-javascript#24590 に対する修正(getsentry/sentry-javascript#24592)は 11.0.0 にだけ入り、10 系には入っていない。v11 に上げて、cron が
cloudflare:workersの env から Queue を読む回避を外す。v11 はメジャーアップデートなので、移行ガイドをこのリポジトリの設定と突き合わせ、送る内容を ADR 0029 のとおりに保つ。変更
Queue の回避を外す — cron は handler の env から
IMPORT_QUEUEを読む。cloudflare:workersの import と、回避の説明を消した。Worker の body の止め方 —
httpServerIntegration({ maxRequestBodySize: "none" })の上書きを外す。v11 の既定のhttpServerIntegrationはdataCollection.httpBodiesを見るので、httpBodies: []だけで body は送られない。Web で IP を送らない —
dataCollection: { userInfo: false }を足す。v11 の既定はuserInfo: trueで、event にinfer_ip: "auto"が付き、session にはip_address: "{{auto}}"が付く。v10 はsendDefaultPiiを設定していなかったので、推定されなかった。header は SDK がRefererとUser-Agentしか付けないので、既定のままにする。withSentryの型 — v11 では、型引数を一部だけ明示すると、戻り値がExportedHandler | WorkerEntrypointConstructorの union 型になる。handler をExportedHandler<Bindings, { jobId: string }>型の変数にしてから渡す形に変えた。テスト
monitoring.test.tsの transport と、送られた event を受け取る配列はファイルで 1 つにした。「SQLの誤り」のテストは event が 0 件でも通る状態だったので、件数も確認するようにした。metrics()を読むので、SDK の修正の回帰テストになる。v11 の既定の変化のうち、受け入れたもの
attachStacktraceが既定で true になる。Errorでない値が投げられたときにもスタックが付き、issue のまとまり方が変わりうる。pageになり、状態は crashed でなく unhandled になる。Release Health は使っていない。確認
pnpm typecheckとappsの lintuserInfo: falseを外すと、infer_ip: 'auto'と{{auto}}で落ちるhttpBodies: []を外すと、body が送られて落ちるtracePropagationTargets: []を外すと、sentry-traceが付いて落ちるwrangler deploy --dry-rundeploy 後に、cron の check-in(
import-queue-health)が届くことはまだ確認していない。