Skip to content

Conversation

parkjoj
Copy link

@parkjoj parkjoj commented Jun 18, 2025

SessionReplayPlugin created with corresponding unit tests.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@williazz
Copy link
Contributor

Hey, are you planning on releasing this change? If not, you should target this PR to a dev branch

// Define the eventWithTime interface based on how it's used in the code
export interface eventWithTime {
type: number;
data: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to be more specific with the schema? What schema does rrweb use?

this.events.push(event);

if (this.events.length >= this.BATCH_SIZE) {
this.flushEvents();
Copy link
Contributor

Choose a reason for hiding this comment

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

Reaching the batch limit seems to be the primary way we are flushing the session replay events.

Is it possible to improve how frequently we are reporting this, such as on an interval?

What happens to the remaining replay events when the window is closed?

}
} catch (error) {
// If recording fails, add the events back to be retried later
this.events = [...eventsToSend, ...this.events];
Copy link
Contributor

Choose a reason for hiding this comment

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

On the backend, are you enforcing a limit on number of events within a single SessionReplayEvent? If so, you'll go over the limit with this approach

import * as rrweb from 'rrweb';
// Define the eventWithTime interface based on how it's used in the code
export interface eventWithTime {
type: number;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is type? Is it an index?

// Default behavior - send to RUM service
this.context.record(SESSION_REPLAY_EVENT_TYPE, {
events: eventsToSend,
sessionId: this.session?.sessionId
Copy link
Contributor

Choose a reason for hiding this comment

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

sessionId is already in the metadata

@williazz
Copy link
Contributor

Approach looks good overall, you'll need smoke and integ tests though

Also try running webpack bundle analyzer to see how many bytes this adds

[key: string]: any;
}
import { InternalPlugin } from '../InternalPlugin';
import { Session } from '../../sessions/SessionManager';
Copy link
Contributor

@williazz williazz Jun 26, 2025

Choose a reason for hiding this comment

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

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