Decide session staleness on a monotonic clock in LifecycleWatcher
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 56/100
调研方向
Start with LifecycleWatcher.isSessionOnScopeStale() in sentry-android-core/src/main/java/io/sentry/android/core/LifecycleWatcher.java, then inspect Session and the existing background-path Deadline usage. Check how session start time is stored and serialized; the change is done when the in-memory monotonic start tick supports the staleness decision and is not serialized. The issue points to no specific test, so locate relevant lifecycle and session tests before making the change.
由索引模型根据 Issue 内容生成。
描述
When the app comes to the foreground with no background window pending, LifecycleWatcher.isSessionOnScopeStale() decides whether to start a new session. This happens when SDK init started the session, rather than the user leaving and coming back. The check compares Session.getStarted() with the wall clock.
A clock step between SDK init and the first foreground gets this wrong:
- A forward step can start a second session when it shouldn't.
- A backward step can keep a stale session.
Release health counts session starts, so either case can move session counts.
Fix
Let a Session remember the monotonic tick it started on. Keep it in memory only and don't serialize it. Then decide staleness with a Deadline, as the background path already does.
Context
getsentry/sentry-java#5580 and getsentry/sentry-java#6585 were closed on 2026-11-18 because Relay ignores the session seq and duration fields. This is the one session clock issue left that affects counts.
Agent notes
sentry-android-core/src/main/java/io/sentry/android/core/LifecycleWatcher.java: seeisSessionOnScopeStale()and itsTODO [MAJOR]on9.x.x(checked 2026-11-18).- Relay at
f218978dbb:relay-server/src/metrics_extraction/sessions/mod.rsbuckets session metrics bystartedand emits only counts.
- 主要语言
- Kotlin
- 星标
- 1.4k
- 派生
- 483
- 平均合并
- 2 天 54 分钟
- 30 天内合并 PR
- 207
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
getsentry/sentry-java 的其他 Issue
-
Test the `sentry wizard` Android port可能已有人在做 @antonis 于 1 天前认领。 未关闭Platform: Java
getsentry/sentry-java#6797 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Narrow and clean up Android consumer keep rules可能已有人在做 @runningcode 于 3 天前认领。 未关闭Android Platform: Java
getsentry/sentry-java#6771 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Android Bug Platform: Java Waiting for: Product Owner
难度 4/5 3-5 天 新手友好度 45/100
getsentry/sentry-java#6758 · 4 条评论 ·
维护者通常 1 天内回复
-
Android Bug Platform: Java Replays
难度 3/5 1-2 天 新手友好度 62/100
getsentry/sentry-java#6741 · 1 条评论 ·
维护者通常 1 天内回复
-
Android Bug Platform: Java Replays
难度 3/5 1-2 天 新手友好度 50/100
getsentry/sentry-java#6740 · 1 条评论 ·
维护者通常 1 天内回复
查看 getsentry/sentry-java 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 62/100
IacobIonut01/ReFra#1515 · 1 条评论 ·
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
openwatersio/slackwater-android#162 ·
维护者通常 1 天内回复
-
bug
难度 2/5 半天 新手友好度 72/100
developmentwithyash/yaan#184 ·
维护者通常 1 天内回复
-
analytics
难度 2/5 1-3 小时 新手友好度 62/100
-
🐛 Type:Bug 📏 Size: S 🔧 State:In Progress 🔹 Priority: P2 - Medium
难度 2/5 1-3 小时 新手友好度 70/100
yeliqin666/xjtu-toolbox-android#623 · 1 条评论 ·