getsentry / getsentry/sentry-java

Improve Stacktrace truncation for StackOverflowError

未關閉
#4,818 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
Errors Feature Java
主要語言
Kotlin
星號
1.4k
分支
478
平均合併
3 天 4 小時
30 天內合併 PR
72

描述

### Problem Statement

We've had reports of [dropped events in the past](https://github.com/getsentry/sentry-java/issues/2988) and in response implemented a [simple limit of 100 frames](https://github.com/getsentry/sentry-java/blob/b66ccf37e6b3000d423c8162a56173ccaeba1ab9/sentry/src/main/java/io/sentry/SentryStackTraceFactory.java#L62-L65).

This limit only uses 100 frames from one side of the stacktrace, leading to potentially unhelpful information shown in our product.

### Solution Brainstorm

In the next major, we could improve the truncation to:
- only trigger on `StackOverflowError` so we do not lose information on smaller stack traces
- this way we don't butcher other stacktraces
- truncate from the middle, i.e. keep frames on both ends of the stacktrace, hopefully truncating only some of the recurring part but keeping the most important frames, see [relay](https://github.com/getsentry/relay/pull/3905/files)
- keep 500 frames from both ends of the stacktrace, i.e. 1000 total frames to be compatible with relay potentially bumping their limit

NOTE: there is a risk of running out of sync with relays implementation / truncation numbers

貢獻指南

開啟貢獻指南

研究方向

從 sentry/src/main/java/io/sentry/SentryStackTraceFactory.java 開始,重點查看現有的 100 幀限制,並將截斷方法與所引用的 Relay pull request 進行比較。定義 StackOverflowError 的截斷行為,包括兩端的幀數以及與 Relay 的相容性預期,然後驗證產生的 stacktrace 保留兩端,同時不改變較小的非溢位 stacktrace。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java
領域
devtools
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。