Skip to content

Change session observer list type#1902

Open
breedx-splk wants to merge 3 commits into
open-telemetry:mainfrom
breedx-splk:session_observer_list
Open

Change session observer list type#1902
breedx-splk wants to merge 3 commits into
open-telemetry:mainfrom
breedx-splk:session_observer_list

Conversation

@breedx-splk

Copy link
Copy Markdown
Contributor

Resolves #1877

@breedx-splk
breedx-splk requested a review from a team as a code owner July 16, 2026 19:48
Copilot AI review requested due to automatic review settings July 16, 2026 19:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.synchronizedList with CopyOnWriteArrayList for SessionManager observers.
  • 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

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.33%. Comparing base (c875da2) to head (b272c95).
⚠️ Report is 2 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@fractalwrench fractalwrench left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a CI failure where the new test case is failing. Otherwise this looks good

@aranhave aranhave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changing how the observers list in SessionManager works

4 participants