Decide session staleness on a monotonic clock in LifecycleWatcher

オープン
#6,663 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
56/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
android, java, kotlin
領域
backend, mobile

調査の方向性

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 の本文から書いたものです。

説明

Platform: Android Platform: Java

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: see isSessionOnScopeStale() and its TODO [MAJOR] on 9.x.x (checked 2026-11-18).
  • Relay at f218978dbb: relay-server/src/metrics_extraction/sessions/mod.rs buckets session metrics by started and emits only counts.
主要言語
Kotlin
スター
1.4k
フォーク
483
平均マージ
2日 54分
マージ済み PR(30日)
207

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

getsentry/sentry-java のほかの issue

getsentry/sentry-java の issue をすべて見る

似ている issue

Kotlin の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。