diff --git a/CHANGELOG.md b/CHANGELOG.md index 3282477fd9..5a2a39a1bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,7 +33,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **pools** Ping Redis every 15 seconds - **pools** Enable `test_before_acquire` on SQLx - **pools** Decrease SQLx `idle_timeout` to 3 minutes -- **pools** Set ClickHoue `idle_timeout` to 15 seconds +- **pools** Set ClickHouse `idle_timeout` to 15 seconds +- **api-helper** Box path futures for faster compile times ### Security @@ -54,6 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **api-helper** Remove excess logging - `user_identity.identities` not getting purged on create & delete - **Bolt** Error when applying Terraform when a plan is no longer required +- **api-helper** Instrument path futures ## [23.2.0-rc.1] - 2023-12-01 diff --git a/lib/api-helper/build/src/start.rs b/lib/api-helper/build/src/start.rs index 3ad6772822..fed273fc4a 100644 --- a/lib/api-helper/build/src/start.rs +++ b/lib/api-helper/build/src/start.rs @@ -136,7 +136,7 @@ where } }, Err(err) => { - tracing::error!(?err, "http error"); + tracing::error!(?err, "tokio spawn error"); return Ok(Response::builder() .status(http::StatusCode::INTERNAL_SERVER_ERROR) .body(Body::empty())?); diff --git a/lib/api-helper/macros/src/lib.rs b/lib/api-helper/macros/src/lib.rs index adf02ddcbf..9bc6ed97b8 100644 --- a/lib/api-helper/macros/src/lib.rs +++ b/lib/api-helper/macros/src/lib.rs @@ -175,7 +175,7 @@ impl EndpointRouter { }; quote! { - .try_or_else(|| async { + .try_or_else(|| rivet_operation::prelude::futures_util::FutureExt::boxed(tracing::Instrument::in_current_span(async { router_config.prefix = #mount_prefix; #mount_path::__inner( @@ -189,7 +189,7 @@ impl EndpointRouter { ) .await .map(std::convert::Into::into) - }).await? + }))).await? } }) .collect::>(); @@ -198,6 +198,7 @@ impl EndpointRouter { pub struct Router; impl Router { #[doc(hidden)] + #[tracing::instrument(skip_all)] pub async fn __inner( shared_client: chirp_client::SharedClientHandle, pools: rivet_pools::Pools, @@ -227,6 +228,7 @@ impl EndpointRouter { Ok(body.into()) } + #[tracing::instrument(skip_all)] pub async fn handle( shared_client: chirp_client::SharedClientHandle, pools: rivet_pools::Pools, @@ -526,7 +528,7 @@ impl Endpoint { .collect::>>()?; Ok(quote! { - .try_or_else(|| async { + .try_or_else(|| rivet_operation::prelude::futures_util::FutureExt::boxed(tracing::Instrument::in_current_span(async { // Unreverse path segments (they are stored in reverse) let mut path_segments = router_config .path_segments @@ -547,7 +549,7 @@ impl Endpoint { } else { Ok(__AsyncOption::None) } - }).await? + }))).await? }) } } @@ -931,7 +933,7 @@ impl EndpointFunction { tokio::sync::oneshot::channel::<(http::StatusCode, String)>(); tokio::task::Builder::new() .name("api_helper::req_metrics_drop") - .spawn(async move { + .spawn(rivet_operation::prelude::futures_util::FutureExt::boxed(tracing::Instrument::in_current_span(async move { // Wait for the request to complete or be // cancelled let complete_msg = metrics_complete_rx.await; @@ -969,7 +971,7 @@ impl EndpointFunction { ]) .inc(); } - })?; + })))?; let fut = #path(ctx, #(#arg_list),*); let timeout = ::tokio::time::Duration::from_secs(50);