Skip to content

feat: session replay minimum recording duration#482

Open
ioannisj wants to merge 14 commits intomainfrom
feat/min_session_duration
Open

feat: session replay minimum recording duration#482
ioannisj wants to merge 14 commits intomainfrom
feat/min_session_duration

Conversation

@ioannisj
Copy link
Copy Markdown
Contributor

@ioannisj ioannisj commented Apr 9, 2026

💡 Motivation and Context

Adds support for the minimumDurationMilliseconds remote config setting for session replay and follows the implementation as described in PostHog/posthog-ios#548

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file
  • Added the "release" label to the PR to indicate we're publishing new versions for the affected packages

@github-actions
Copy link
Copy Markdown
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@github-actions github-actions Bot added the stale label Apr 17, 2026
@ioannisj ioannisj removed the stale label Apr 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@github-actions github-actions Bot added the stale label Apr 29, 2026
@ioannisj ioannisj removed the stale label Apr 29, 2026
# Conflicts:
#	posthog-android/api/posthog-android.api
#	posthog-android/src/main/java/com/posthog/android/replay/PostHogReplayIntegration.kt
#	posthog/src/main/java/com/posthog/internal/PostHogRemoteConfig.kt
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

posthog-android Compliance Report

Date: 2026-04-29 20:29:50 UTC
Duration: 486ms

⚠️ Some Tests Failed

0/1 tests passed, 1 failed


Feature_Flags Tests

⚠️ 0/1 tests passed, 1 failed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id 272ms

Failures

request_payload.request_with_person_properties_device_id

404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'

@ioannisj ioannisj marked this pull request as ready for review April 29, 2026 14:27
@ioannisj ioannisj requested a review from a team as a code owner April 29, 2026 14:27
@ioannisj ioannisj requested review from a team, TueHaulund, fasyy612, ksvat and nicowaltz and removed request for a team April 29, 2026 14:27
Copy link
Copy Markdown
Contributor

@dustinbyrne dustinbyrne left a comment

Choose a reason for hiding this comment

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

Got through some of this but I have to step away. I'll circle back when I can if nobody else gets to it first!

* [PostHogReplayBufferDelegate]. When [PostHogReplayBufferDelegate.isBuffering]
* is true, snapshots are routed to the buffer and `flush()` calls are suppressed.
*/
public class PostHogReplayQueue internal constructor(
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.

Can this be internal? Does it need to be public?

Comment on lines +55 to +61
if (bufferDelegate?.isBuffering == true) {
bufferQueue.add(event)
config.logger.log("Buffered replay event '${event.event}'. Buffer depth: ${bufferQueue.depth}")
bufferDelegate?.onReplayBufferSnapshot(this)
} else {
innerQueue.add(event)
}
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.

This is a synchronous write to disk. Perhaps this queue should be constructed with an ExecutorService similar to PostHogQueue and serialize buffer writes through it to avoid blocking the calling thread?

Comment on lines +1627 to +1628
// Reset minimum duration buffering state for the new session
resetBufferingState()
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.

start is only called once globally afaik, so it seems like this call would be better off in onSessionIdChanged?

@dustinbyrne dustinbyrne requested a review from a team April 29, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants