@@ -41,10 +41,10 @@ pub fn process(
41
41
return Ok ( ( ) ) ;
42
42
}
43
43
44
- let rs = {
44
+ let rpc = {
45
45
let meta = state. envelope ( ) . meta ( ) ;
46
46
47
- ReplayState {
47
+ ReplayProcessingConfig {
48
48
config : & state. project_state . config ,
49
49
global_config,
50
50
geoip_lookup,
@@ -63,7 +63,7 @@ pub fn process(
63
63
. project_state
64
64
. has_feature ( Feature :: SessionReplayRecordingScrubbing )
65
65
{
66
- let datascrubbing_config = rs
66
+ let datascrubbing_config = rpc
67
67
. config
68
68
. datascrubbing_settings
69
69
. pii_config ( )
@@ -72,7 +72,7 @@ pub fn process(
72
72
73
73
Some ( RecordingScrubber :: new (
74
74
state. config . max_replay_uncompressed_size ( ) ,
75
- rs . config . pii_config . as_ref ( ) ,
75
+ rpc . config . pii_config . as_ref ( ) ,
76
76
datascrubbing_config,
77
77
) )
78
78
} else {
@@ -89,7 +89,7 @@ pub fn process(
89
89
90
90
match item. ty ( ) {
91
91
ItemType :: ReplayEvent => {
92
- let replay_event = handle_replay_event_item ( item. payload ( ) , & rs ) ?;
92
+ let replay_event = handle_replay_event_item ( item. payload ( ) , & rpc ) ?;
93
93
item. set_payload ( ContentType :: Json , replay_event) ;
94
94
}
95
95
ItemType :: ReplayRecording => {
@@ -99,7 +99,7 @@ pub fn process(
99
99
}
100
100
ItemType :: ReplayVideo => {
101
101
let replay_video =
102
- handle_replay_video_item ( item. payload ( ) , scrubber. as_mut ( ) , & rs ) ?;
102
+ handle_replay_video_item ( item. payload ( ) , scrubber. as_mut ( ) , & rpc ) ?;
103
103
item. set_payload ( ContentType :: OctetStream , replay_video) ;
104
104
}
105
105
_ => { }
@@ -110,7 +110,7 @@ pub fn process(
110
110
}
111
111
112
112
#[ derive( Debug ) ]
113
- struct ReplayState < ' a > {
113
+ struct ReplayProcessingConfig < ' a > {
114
114
pub config : & ' a ProjectConfig ,
115
115
pub global_config : & ' a GlobalConfig ,
116
116
pub geoip_lookup : Option < & ' a GeoIpLookup > ,
@@ -125,16 +125,16 @@ struct ReplayState<'a> {
125
125
126
126
fn handle_replay_event_item (
127
127
payload : Bytes ,
128
- state : & ReplayState < ' _ > ,
128
+ config : & ReplayProcessingConfig < ' _ > ,
129
129
) -> Result < Bytes , ProcessingError > {
130
- match process_replay_event ( & payload, state ) {
130
+ match process_replay_event ( & payload, config ) {
131
131
Ok ( replay) => {
132
132
if let Some ( replay_type) = replay. value ( ) {
133
133
relay_filter:: should_filter (
134
134
replay_type,
135
- state . client_addr ,
136
- & state . config . filter_settings ,
137
- state . global_config . filters ( ) ,
135
+ config . client_addr ,
136
+ & config . config . filter_settings ,
137
+ config . global_config . filters ( ) ,
138
138
)
139
139
. map_err ( ProcessingError :: ReplayFiltered ) ?;
140
140
@@ -145,9 +145,9 @@ fn handle_replay_event_item(
145
145
metric ! ( counter( RelayCounters :: ReplayExceededSegmentLimit ) += 1 ) ;
146
146
147
147
relay_log:: warn!(
148
- event_id = ?state . event_id,
149
- project_id = state . project_id. map( |v| v. value( ) ) ,
150
- organization_id = state . organization_id,
148
+ event_id = ?config . event_id,
149
+ project_id = config . project_id. map( |v| v. value( ) ) ,
150
+ organization_id = config . organization_id,
151
151
segment_id = segment_id,
152
152
"replay segment-exceeded-limit"
153
153
) ;
@@ -160,7 +160,7 @@ fn handle_replay_event_item(
160
160
Err ( error) => {
161
161
relay_log:: error!(
162
162
error = & error as & dyn Error ,
163
- event_id = ?state . event_id,
163
+ event_id = ?config . event_id,
164
164
"failed to serialize replay"
165
165
) ;
166
166
Ok ( payload)
@@ -170,9 +170,9 @@ fn handle_replay_event_item(
170
170
Err ( error) => {
171
171
relay_log:: warn!(
172
172
error = & error as & dyn Error ,
173
- event_id = ?state . event_id,
174
- project_id = state . project_id. map( |v| v. value( ) ) ,
175
- organization_id = state . organization_id,
173
+ event_id = ?config . event_id,
174
+ project_id = config . project_id. map( |v| v. value( ) ) ,
175
+ organization_id = config . organization_id,
176
176
"invalid replay event"
177
177
) ;
178
178
Err ( match error {
@@ -196,7 +196,7 @@ fn handle_replay_event_item(
196
196
/// Validates, normalizes, and scrubs PII from a replay event.
197
197
fn process_replay_event (
198
198
payload : & [ u8 ] ,
199
- state : & ReplayState < ' _ > ,
199
+ config : & ReplayProcessingConfig < ' _ > ,
200
200
) -> Result < Annotated < Replay > , ReplayError > {
201
201
let mut replay =
202
202
Annotated :: < Replay > :: from_json_bytes ( payload) . map_err ( ReplayError :: CouldNotParse ) ?;
@@ -208,18 +208,18 @@ fn process_replay_event(
208
208
replay:: validate ( replay_value) ?;
209
209
replay:: normalize (
210
210
& mut replay,
211
- state . client_addr ,
212
- state . user_agent . as_deref ( ) ,
213
- state . geoip_lookup ,
211
+ config . client_addr ,
212
+ config . user_agent . as_deref ( ) ,
213
+ config . geoip_lookup ,
214
214
) ;
215
215
216
- if let Some ( ref config) = state . config . pii_config {
216
+ if let Some ( ref config) = config . config . pii_config {
217
217
let mut processor = PiiProcessor :: new ( config. compiled ( ) ) ;
218
218
processor:: process_value ( & mut replay, & mut processor, ProcessingState :: root ( ) )
219
219
. map_err ( |e| ReplayError :: CouldNotScrub ( e. to_string ( ) ) ) ?;
220
220
}
221
221
222
- let pii_config = state
222
+ let pii_config = config
223
223
. config
224
224
. datascrubbing_settings
225
225
. pii_config ( )
@@ -272,7 +272,7 @@ struct ReplayVideoEvent {
272
272
fn handle_replay_video_item (
273
273
payload : Bytes ,
274
274
scrubber : Option < & mut RecordingScrubber > ,
275
- state : & ReplayState < ' _ > ,
275
+ config : & ReplayProcessingConfig < ' _ > ,
276
276
) -> Result < Bytes , ProcessingError > {
277
277
let ReplayVideoEvent {
278
278
replay_event,
@@ -282,7 +282,7 @@ fn handle_replay_video_item(
282
282
. map_err ( |_| ProcessingError :: InvalidReplay ( DiscardReason :: InvalidReplayVideoEvent ) ) ?;
283
283
284
284
// Process as a replay-event envelope item.
285
- let replay_event = handle_replay_event_item ( replay_event, state ) ?;
285
+ let replay_event = handle_replay_event_item ( replay_event, config ) ?;
286
286
287
287
// Process as a replay-recording envelope item.
288
288
let replay_recording = handle_replay_recording_item ( replay_recording, scrubber) ?;
0 commit comments