@@ -45,11 +45,14 @@ export default class ReplayManager {
45
45
}
46
46
47
47
this . _map = new Map ( ) ;
48
- this . _recorder = new Recorder ( options ) ;
48
+ this . _predicates = new ReplayPredicates ( options ) ;
49
+ this . _recorder = new Recorder ( {
50
+ ...options ,
51
+ maxPreDuration : this . _predicates . maxPreDuration ,
52
+ } ) ;
49
53
this . _tracing = tracing ;
50
54
this . _telemeter = telemeter ;
51
55
this . _trailingStatus = new Map ( ) ;
52
- this . _predicates = new ReplayPredicates ( options ) ;
53
56
this . _scheduledCapture = new ScheduledCapture ( {
54
57
recorder : this . _recorder ,
55
58
tracing : this . _tracing ,
@@ -85,6 +88,14 @@ export default class ReplayManager {
85
88
return status === TrailingStatus . SENT || status === TrailingStatus . SKIPPED ;
86
89
}
87
90
91
+ configure ( options ) {
92
+ this . _predicates . configure ( options ) ;
93
+ this . _recorder . configure ( {
94
+ ...options ,
95
+ maxPreDuration : this . _predicates . maxPreDuration ,
96
+ } ) ;
97
+ }
98
+
88
99
/**
89
100
* Exports recording and telemetry spans, then stores the tracing payload in the map.
90
101
*
@@ -123,7 +134,7 @@ export default class ReplayManager {
123
134
const payload = this . _tracing . exporter . toPayload ( ) ;
124
135
this . _map . set ( replayId , payload ) ;
125
136
126
- const leadingSeconds = this . _recorder . options ?. postDuration || 0 ;
137
+ const leadingSeconds = trigger ?. postDuration || 0 ;
127
138
if ( leadingSeconds > 0 ) {
128
139
this . _scheduledCapture . schedule ( replayId , occurrenceUuid , leadingSeconds ) ;
129
140
this . _trailingStatus . set ( replayId , TrailingStatus . PENDING ) ;
@@ -149,6 +160,11 @@ export default class ReplayManager {
149
160
150
161
replayId = replayId || id . gen ( 8 ) ;
151
162
163
+ /*
164
+ * trigger.preDuration and trigger.postDuration are the requested capture
165
+ * durations for the trigger. The recorder buffers have been configured to
166
+ * handle the max preDuration across all triggers.
167
+ */
152
168
const trigger = this . _predicates . shouldCaptureForTriggerContext ( {
153
169
...triggerContext ,
154
170
replayId,
0 commit comments