Skip to content

Commit

Permalink
feat(replays): Use user configured PII scrubbers (#1731)
Browse files Browse the repository at this point in the history
Removes statically defined scrubbers with data scrubbing and PII config
from the project state. This includes a refactor that moves replay
scrubbing on a struct.

---------

Co-authored-by: Jan Michael Auer <[email protected]>
  • Loading branch information
cmanallen and jan-auer authored Feb 3, 2023
1 parent 57aacf0 commit 44fbca1
Show file tree
Hide file tree
Showing 6 changed files with 442 additions and 344 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
**Features**:

- Add support for client hints. ([#1752](https://github.com/getsentry/relay/pull/1752))
- Apply all configured data scrubbing rules on Replays. ([#1731](https://github.com/getsentry/relay/pull/1731))
- Add count transactions toward root project. ([#1734](https://github.com/getsentry/relay/pull/1734))

**Bug Fixes**:
Expand Down
14 changes: 12 additions & 2 deletions relay-replays/benches/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use std::io::Read;

use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use flate2::{bufread::ZlibEncoder, Compression};
use relay_replays::recording::transcode_replay;

use relay_general::pii::DataScrubbingConfig;
use relay_replays::recording::ReplayScrubber;

fn bench_recording(c: &mut Criterion) {
let payload = include_bytes!("../tests/fixtures/rrweb.json");
Expand All @@ -13,10 +15,18 @@ fn bench_recording(c: &mut Criterion) {
let mut encoder = ZlibEncoder::new(payload.as_slice(), Compression::default());
encoder.read_to_end(&mut compressed).unwrap();

let mut scrubbing_config = DataScrubbingConfig::default();
scrubbing_config.scrub_data = true;
scrubbing_config.scrub_defaults = true;
scrubbing_config.scrub_ip_addresses = true;
let pii_config = scrubbing_config.pii_config_uncached().unwrap().unwrap();

let mut scrubber = ReplayScrubber::new(usize::MAX, Some(&pii_config), None);

c.bench_with_input(BenchmarkId::new("rrweb", 1), &compressed, |b, &_| {
b.iter(|| {
let mut buf = Vec::new();
transcode_replay(criterion::black_box(&compressed), usize::MAX, &mut buf).ok();
scrubber.transcode_replay(&compressed, &mut buf).ok();
buf
});
});
Expand Down
Loading

0 comments on commit 44fbca1

Please sign in to comment.