Skip to content

feat(analytics): send session start and stop events - #3496

Merged
mattcreaser merged 7 commits into
mainfrom
fix/enrichment-session-events
Oct 23, 2026
Merged

mattcreaser merged 7 commits into
mainfrom
fix/enrichment-session-events

Conversation

@ekjotmultani

@ekjotmultani ekjotmultani commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Session starts and stops are now sent to the sink as _session.start and _session.stop events. The stop event carries stop_timestamp and duration, which were computed before but never sent.

  • Every send goes through one ordered queue, so the sink receives events in call order and nothing after the final stop from close(). close() no longer drops sends that are still queued.
  • Resuming after an explicit stopSession() no longer starts a new session, a second stopSession() no longer changes the stop time, a stale timeout no longer stops a resumed session, and session calls do nothing after close().
  • A session that starts while the app is in the background is paused right away, so it still times out.
  • New options: emitSessionEvents (default true) to turn the session events off, and initialUserId, initialGlobalAttributes and initialGlobalMetrics so the launch _session.start can carry them.

Related: aws-amplify/amplify-swift#4180

@ekjotmultani
ekjotmultani requested a review from a team as a code owner October 22, 2026 16:15
@github-actions github-actions Bot added the Title Needs Formatting Added by the PR Title Checker when a PR title does not conform to our guidelines label Oct 22, 2026
@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.11650% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.77%. Comparing base (f3370de) to head (485a6fd).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3496      +/-   ##
==========================================
+ Coverage   57.65%   57.77%   +0.12%     
==========================================
  Files        1128     1129       +1     
  Lines       33198    33268      +70     
  Branches     4949     4961      +12     
==========================================
+ Hits        19140    19221      +81     
+ Misses      12130    12120      -10     
+ Partials     1928     1927       -1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ekjotmultani
ekjotmultani requested a review from a team as a code owner October 22, 2026 18:32
deliver() caught only Exception, so an Error from the sink ended the consumer and nothing after it was sent.
@ekjotmultani ekjotmultani changed the title feat(event-enrichment): send session start and stop events feat(analytics): send session start and stop events Oct 22, 2026
@github-actions github-actions Bot removed the Title Needs Formatting Added by the PR Title Checker when a PR title does not conform to our guidelines label Oct 22, 2026
@mattcreaser
mattcreaser merged commit 2d7d371 into main Oct 23, 2026
21 of 22 checks passed
@mattcreaser
mattcreaser deleted the fix/enrichment-session-events branch October 23, 2026 13:41
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.

2 participants