antithesis_intake/http.rs
1//! Axum HTTP surface for the intake.
2//!
3//! This module composes the intake router while submodules keep protocol groups
4//! and middleware separate.
5
6use axum::{http::StatusCode, Router};
7
8mod datadog;
9pub(crate) mod middleware;
10mod state;
11
12use self::state::AppState;
13
14/// Memory backstop on the compressed body buffered before decompression. Sits above any Pyld05 spec limit.
15const MAX_COMPRESSED_BODY_BYTES: usize = 64 * 1024 * 1024;
16
17/// Caps the decompressed body a handler buffers. Exceeds every Pyld06 spec limit.
18const MAX_DECOMPRESSED_BODY_BYTES: usize = 64 * 1024 * 1024;
19
20/// Build the intake router. `/api/v2/series` fires payload assertions. Datadog endpoints answer
21/// 202. A malformed body gets 400. An oversized body gets 413. Unmatched paths answer 200.
22pub fn build_router() -> Router {
23 Router::new()
24 .merge(datadog::routes())
25 .fallback(|| async { StatusCode::OK })
26 .with_state(AppState::default())
27}