Skip to content

Commit

Permalink
build: update axum dependency (#4450)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dav1dde authored Jan 16, 2025
1 parent fb0281b commit f69f89e
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 48 deletions.
74 changes: 62 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ android_trace_log = { version = "0.3.0", features = ["serde"] }
# which will increase processing time for transactions massively.
# Keep it pinned until it's possible to disable backtrace.
anyhow = "=1.0.69"
axum = "0.7.9"
axum-extra = "0.9.6"
axum = "0.8.1"
axum-extra = "0.10.0"
axum-server = "0.7.1"
arc-swap = "1.7.1"
backoff = "0.4.0"
Expand Down
1 change: 0 additions & 1 deletion relay-server/src/endpoints/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ impl EnvelopeParams {
}
}

#[axum::async_trait]
impl FromRequest<ServiceState> for EnvelopeParams {
type Rejection = BadEnvelopeParams;

Expand Down
34 changes: 17 additions & 17 deletions relay-server/src/endpoints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ const BATCH_JSON_BODY_LIMIT: usize = 50_000_000; // 50 MB
pub fn routes(config: &Config) -> Router<ServiceState>{
// Relay-internal routes pointing to /api/relay/
let internal_routes = Router::new()
.route("/api/relay/healthcheck/:kind/", get(health_check::handle))
.route("/api/relay/events/:event_id/", get(events::handle));
.route("/api/relay/healthcheck/{kind}/", get(health_check::handle))
.route("/api/relay/events/{event_id}/", get(events::handle));
let internal_routes = internal_routes
// Fallback route, but with a name, and just on `/api/relay/*`.
.route("/api/relay/*not_found", any(statics::not_found));
.route("/api/relay/{*not_found}", any(statics::not_found));

// Sentry Web API routes pointing to /api/0/relays/
let web_routes = Router::new()
Expand All @@ -60,22 +60,22 @@ pub fn routes(config: &Config) -> Router<ServiceState>{
// Legacy store path that is missing the project parameter.
.route("/api/store/", store::route(config))
// cron monitor level routes. These are user facing APIs and as such support trailing slashes.
.route("/api/:project_id/cron/:monitor_slug/:sentry_key", monitor::route(config))
.route("/api/:project_id/cron/:monitor_slug/:sentry_key/", monitor::route(config))
.route("/api/:project_id/cron/:monitor_slug", monitor::route(config))
.route("/api/:project_id/cron/:monitor_slug/", monitor::route(config))
.route("/api/{project_id}/cron/{monitor_slug}/{sentry_key}", monitor::route(config))
.route("/api/{project_id}/cron/{monitor_slug}/{sentry_key}/", monitor::route(config))
.route("/api/{project_id}/cron/{monitor_slug}", monitor::route(config))
.route("/api/{project_id}/cron/{monitor_slug}/", monitor::route(config))

.route("/api/:project_id/store/", store::route(config))
.route("/api/:project_id/envelope/", envelope::route(config))
.route("/api/:project_id/security/", security_report::route(config))
.route("/api/:project_id/csp-report/", security_report::route(config))
.route("/api/:project_id/nel/", nel::route(config))
.route("/api/{project_id}/store/", store::route(config))
.route("/api/{project_id}/envelope/", envelope::route(config))
.route("/api/{project_id}/security/", security_report::route(config))
.route("/api/{project_id}/csp-report/", security_report::route(config))
.route("/api/{project_id}/nel/", nel::route(config))
// No mandatory trailing slash here because people already use it like this.
.route("/api/:project_id/minidump", minidump::route(config))
.route("/api/:project_id/minidump/", minidump::route(config))
.route("/api/:project_id/events/:event_id/attachments/", post(attachments::handle))
.route("/api/:project_id/unreal/:sentry_key/", unreal::route(config))
.route("/api/:project_id/otlp/v1/traces/", traces::route(config))
.route("/api/{project_id}/minidump", minidump::route(config))
.route("/api/{project_id}/minidump/", minidump::route(config))
.route("/api/{project_id}/events/{event_id}/attachments/", post(attachments::handle))
.route("/api/{project_id}/unreal/{sentry_key}/", unreal::route(config))
.route("/api/{project_id}/otlp/v1/traces/", traces::route(config))
// NOTE: If you add a new (non-experimental) route here, please also list it in
// https://github.com/getsentry/sentry-docs/blob/master/docs/product/relay/operating-guidelines.mdx
.route_layer(middlewares::cors());
Expand Down
3 changes: 1 addition & 2 deletions relay-server/src/extractors/content_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ impl AsRef<str> for RawContentType {
}
}

#[axum::async_trait]
impl<S> FromRequestParts<S> for RawContentType {
impl<S: Send + Sync> FromRequestParts<S> for RawContentType {
type Rejection = Infallible;

async fn from_request_parts(parts: &mut Parts, _: &S) -> Result<Self, Self::Rejection> {
Expand Down
1 change: 0 additions & 1 deletion relay-server/src/extractors/forwarded_for.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ impl From<ForwardedFor> for String {
}
}

#[axum::async_trait]
impl<S> FromRequestParts<S> for ForwardedFor
where
S: Send + Sync,
Expand Down
3 changes: 1 addition & 2 deletions relay-server/src/extractors/mime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ impl IntoResponse for MimeError {
}
}

#[axum::async_trait]
impl<S> FromRequestParts<S> for Mime {
impl<S: Send + Sync> FromRequestParts<S> for Mime {
type Rejection = MimeError;

async fn from_request_parts(parts: &mut Parts, _: &S) -> Result<Self, Self::Rejection> {
Expand Down
1 change: 0 additions & 1 deletion relay-server/src/extractors/received_at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ impl ReceivedAt {
}
}

#[axum::async_trait]
impl<S> FromRequestParts<S> for ReceivedAt
where
S: Send + Sync,
Expand Down
2 changes: 0 additions & 2 deletions relay-server/src/extractors/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use crate::utils::{self, ApiErrorResponse};
/// use crate::extractors::Remote;
///
/// // Derive `FromRequest` for `bool` for illustration purposes:
/// #[axum::async_trait]
/// impl<S> axum::extract::FromRequest<S> for Remote<bool> {
/// type Rejection = Remote<Infallible>;
///
Expand All @@ -45,7 +44,6 @@ impl<T> From<T> for Remote<T> {
}
}

#[axum::async_trait]
impl FromRequest<ServiceState> for Remote<Multipart<'static>> {
type Rejection = Remote<multer::Error>;

Expand Down
2 changes: 0 additions & 2 deletions relay-server/src/extractors/request_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ impl PartialMeta {
}
}

#[axum::async_trait]
impl FromRequestParts<ServiceState> for PartialMeta {
type Rejection = Infallible;

Expand Down Expand Up @@ -622,7 +621,6 @@ struct StorePath {
sentry_key: Option<String>,
}

#[axum::async_trait]
impl FromRequestParts<ServiceState> for RequestMeta {
type Rejection = BadEventMeta;

Expand Down
2 changes: 0 additions & 2 deletions relay-server/src/extractors/signed_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ pub struct SignedBytes {
pub relay: RelayInfo,
}

#[axum::async_trait]
impl FromRequest<ServiceState> for SignedBytes {
type Rejection = SignatureError;

Expand Down Expand Up @@ -105,7 +104,6 @@ pub struct SignedJson<T> {
pub relay: RelayInfo,
}

#[axum::async_trait]
impl<T> FromRequest<ServiceState> for SignedJson<T>
where
T: DeserializeOwned,
Expand Down
2 changes: 1 addition & 1 deletion relay-server/src/middlewares/body_timing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl<S> BodyTiming<S> {
}
}

impl<S> Service<Request<Body>> for BodyTiming<S>
impl<S: Send + Sync> Service<Request<Body>> for BodyTiming<S>
where
S: Service<Request<Body>>,
{
Expand Down
4 changes: 2 additions & 2 deletions relay-server/src/middlewares/sentry_tower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ where
H: Into<Arc<Hub>>,
{
provider: P,
_hub: PhantomData<(H, Request)>,
_hub: PhantomData<fn() -> (H, Request)>,
}

impl<S, P, H, Request> Layer<S> for SentryLayer<P, H, Request>
Expand Down Expand Up @@ -296,7 +296,7 @@ where
{
service: S,
provider: P,
_hub: PhantomData<(H, Request)>,
_hub: PhantomData<fn() -> (H, Request)>,
}

impl<S, Request, P, H> Service<Request> for SentryService<S, P, H, Request>
Expand Down
1 change: 0 additions & 1 deletion relay-server/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@ fn initialize_redis_scripts(
Ok(())
}

#[axum::async_trait]
impl FromRequestParts<Self> for ServiceState {
type Rejection = Infallible;

Expand Down

0 comments on commit f69f89e

Please sign in to comment.