`beforeSend`: type `event_id` and `timestamp` as required
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 65/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript
研究方向
先沿著 _processEvent 經過 prepareEvent 追蹤到 processBeforeSend,並找出 @sentry/core 中的 beforeSend 和 beforeSendTransaction 回呼型別。更新它們的參數型別,讓已準備的事件必須包含 event_id 和 timestamp,接著執行相關的 TypeScript 型別檢查和測試。完成條件是兩個回呼都將這些欄位列為必要欄位,且現有的回呼回傳型別維持不變。
由索引模型根據 Issue 內容生成。
描述
Problem Statement
beforeSend receives an ErrorEvent, which inherits event_id?: string and timestamp?: number from Event. But by the time beforeSend runs, both are always set: _processEvent only calls processBeforeSend with the result of prepareEvent, which does
event_id: event.event_id || hint.event_id || uuid4(),
timestamp: event.timestamp || dateTimestampInSeconds(),
So a common beforeSend use, like showing the user the event ID in a "report this error" link, needs a ! or a fallback that can never run.
Solution Brainstorm
Type the beforeSend parameter as ErrorEvent & { event_id: string; timestamp: number } (or a named "prepared event" type), and do the same for beforeSendTransaction. This only narrows a callback parameter, so existing callbacks still type-check, and the return type can stay ErrorEvent | null.
Additional Context
@sentry/core 11.6.0
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
- 主要語言
- TypeScript
- 星號
- 8.8k
- 分支
- 1.9k
- 平均合併
- 1 天 10 小時
- 30 天內合併 PR
- 548
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
getsentry/sentry-javascript 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 80/100
getsentry/sentry-javascript#24860 · 1 則留言 ·
維護者通常 1 天內回覆
-
javascript
難度 2/5 1-3 小時 新手友好度 75/100
getsentry/sentry-javascript#24200 · 2 則留言 ·
維護者通常 1 天內回覆
-
Cloudflare Workers javascript Tests
難度 2/5 1-3 小時 新手友好度 78/100
getsentry/sentry-javascript#24051 · 1 則留言 ·
維護者通常 1 天內回覆
-
Elysia events report as `sentry.javascript.bun`可能已有人在做 @Shubham-Padkonde 於 24 天前認領。 未關閉Bug Bun javascript
難度 2/5 1-3 小時 新手友好度 92/100
getsentry/sentry-javascript#24045 · 1 則留言 ·
維護者通常 1 天內回覆
-
javascript
難度 2/5 1-3 小時 新手友好度 75/100
getsentry/sentry-javascript#24043 · 1 則留言 ·
維護者通常 1 天內回覆
查看 getsentry/sentry-javascript 的全部 Issue
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 83/100
維護者通常 1 天內回覆
-
Feil lovtekst i bekreftelsen når leder melder unntak fra oppfølgingsplan可能已有人在做 @AudunSorheim 今天認領。 未關閉
難度 1/5 1 小時以內 新手友好度 92/100
navikt/syfo-oppfolgingsplan-frontend#1110 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
db-ux-design-system/core-web#8461 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
Cannot run an integration on windows when power shell is selected as the default profile terminal未關閉Priority/Blocker Type/Bug
難度 2/5 1-3 小時 新手友好度 76/100
wso2/product-integrator#2767 ·
維護者通常 1 天內回覆