Change session observer list type#1902
Conversation
There was a problem hiding this comment.
Pull request overview
Updates SessionManager’s internal observer storage to address concurrent modification risk described in #1877 (iteration safety when observers are mutated during callbacks), aligning the implementation with a concurrency-safe list type for observer notification.
Changes:
- Replace
Collections.synchronizedListwithCopyOnWriteArrayListforSessionManagerobservers. - Add a new unit test intended to cover adding an observer while notifications are in progress.
PR Merge Tier: Tier 2 (small internal concurrency/robustness fix + test)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| android-agent/src/main/kotlin/io/opentelemetry/android/agent/session/SessionManager.kt | Switch observer list implementation to CopyOnWriteArrayList to make iteration safe under concurrent mutation. |
| android-agent/src/test/kotlin/io/opentelemetry/android/agent/session/SessionManagerTest.kt | Add coverage for observer addition during notification (currently asserts behavior that doesn’t match implementation). |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1902 +/- ##
=======================================
Coverage 65.33% 65.33%
=======================================
Files 169 169
Lines 3871 3871
Branches 420 420
=======================================
Hits 2529 2529
Misses 1211 1211
Partials 131 131 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
fractalwrench
left a comment
There was a problem hiding this comment.
There's a CI failure where the new test case is failing. Otherwise this looks good
Resolves #1877