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

fix(server): Increase size limits for batch endpoints #3562

Merged
merged 3 commits into from
May 7, 2024
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 @@ -15,6 +15,7 @@
- Forward `span.data` on the Kafka message. ([#3523](https://github.com/getsentry/relay/pull/3523))
- Tag span duration metric like exclusive time. ([#3524](https://github.com/getsentry/relay/pull/3524))
- Emit negative outcomes for denied metrics. ([#3508](https://github.com/getsentry/relay/pull/3508))
- Increase size limits for internal batch endpoints. ([#3562](https://github.com/getsentry/relay/pull/3562))

## 24.4.2

Expand Down
11 changes: 9 additions & 2 deletions relay-server/src/endpoints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ use relay_config::Config;
use crate::middlewares;
use crate::service::ServiceState;

/// Size limit for internal batch endpoints.
const BATCH_JSON_BODY_LIMIT: usize = 50_000_000; // 50 MB

#[rustfmt::skip]
pub fn routes<B>(config: &Config) -> Router<ServiceState, B>
where
Expand All @@ -62,12 +65,15 @@ where
let web_routes = Router::new()
.route("/api/0/relays/projectconfigs/", post(project_configs::handle))
.route("/api/0/relays/publickeys/", post(public_keys::handle))
.route("/api/0/relays/outcomes/", post(batch_outcomes::handle))
.route("/api/0/relays/metrics/", post(batch_metrics::handle))
// Network connectivity check for downstream Relays, same as the internal health check.
.route("/api/0/relays/live/", get(health_check::handle_live))
.route_layer(DefaultBodyLimit::max(crate::constants::MAX_JSON_SIZE));

let batch_routes = Router::new()
.route("/api/0/relays/outcomes/", post(batch_outcomes::handle))
.route("/api/0/relays/metrics/", post(batch_metrics::handle))
.route_layer(DefaultBodyLimit::max(BATCH_JSON_BODY_LIMIT));

// Ingestion routes pointing to /api/:project_id/
let store_routes = Router::new()
// Legacy store path that is missing the project parameter.
Expand Down Expand Up @@ -97,6 +103,7 @@ where

router.merge(internal_routes)
.merge(web_routes)
.merge(batch_routes)
.merge(store_routes)
// Forward all other API routes to the upstream. This will 404 for non-API routes.
.fallback(forward::forward)
Expand Down
Loading