Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(replays): Add max replay size configuration parameter #1694

Merged
merged 8 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Add `app.in_foreground` and `thread.main` flag to protocol. ([#1578](https://github.com/getsentry/relay/pull/1578))
- Add support for View Hierarchy attachment_type. ([#1642](https://github.com/getsentry/relay/pull/1642))
- Add invalid replay recording outcome. ([#1684]https://github.com/getsentry/relay/pull/1684)
- Add max replay size configuration parameter. ([#1694](https://github.com/getsentry/relay/pull/1694))

**Bug Fixes**:

Expand Down
8 changes: 8 additions & 0 deletions relay-config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ struct Limits {
max_api_chunk_upload_size: ByteSize,
/// The maximum payload size for a profile
max_profile_size: ByteSize,
/// The maximum payload size for a replay.
max_replay_size: ByteSize,
/// The maximum number of threads to spawn for CPU and web work, each.
///
/// The total number of threads spawned will roughly be `2 * max_thread_count + 1`. Defaults to
Expand Down Expand Up @@ -571,6 +573,7 @@ impl Default for Limits {
max_api_file_upload_size: ByteSize::mebibytes(40),
max_api_chunk_upload_size: ByteSize::mebibytes(100),
max_profile_size: ByteSize::mebibytes(50),
max_replay_size: ByteSize::mebibytes(100),
max_thread_count: num_cpus::get(),
query_timeout: 30,
max_connection_rate: 256,
Expand Down Expand Up @@ -1714,6 +1717,11 @@ impl Config {
self.values.limits.max_profile_size.as_bytes()
}

/// Returns the maximum payload size for a replay.
pub fn max_replay_size(&self) -> usize {
self.values.limits.max_replay_size.as_bytes()
}

/// Returns the maximum number of active requests
pub fn max_concurrent_requests(&self) -> usize {
self.values.limits.max_concurrent_requests
Expand Down
6 changes: 3 additions & 3 deletions relay-server/src/actors/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1021,11 +1021,11 @@ impl EnvelopeProcessorService {
// XXX: Temporarily, only the Sentry org will be allowed to parse replays while
// we measure the impact of this change.
if replays_enabled && state.project_state.organization_id == Some(1) {
// Limit expansion of recordings to the envelope size. The payload is
// Limit expansion of recordings to the max replay size. The payload is
// decompressed temporarily and then immediately re-compressed. However, to
// limit memory pressure, we use the envelope limit as a good overall limit for
// limit memory pressure, we use the replay limit as a good overall limit for
// allocations.
let limit = self.config.max_envelope_size();
let limit = self.config.max_replay_size();
cmanallen marked this conversation as resolved.
Show resolved Hide resolved
let parsed_recording =
relay_replays::recording::process_recording(&item.payload(), limit);

Expand Down