Ship production optimization M1-M12.5A: queues, metrics, HTTP observability, and vector search reliability.
Keep similar-ai from tripping the global circuit on a lone URL 502, clamp Qdrant search to 100, and add Server-Timing plus slow-request logging. Studio shared props, Academy S3 exists caching, heat chunking, and Redis/scheduler hygiene stay in this rollout.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Support\Http;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Ssr\Gateway;
|
||||
use Inertia\Ssr\HttpGateway;
|
||||
use Inertia\Ssr\Response;
|
||||
|
||||
/**
|
||||
* Times the existing Inertia SSR HTTP round-trip. Does not change SSR behavior.
|
||||
*/
|
||||
final class TimedInertiaSsrGateway implements Gateway
|
||||
{
|
||||
public function __construct(private readonly HttpGateway $inner)
|
||||
{
|
||||
}
|
||||
|
||||
public function dispatch(array $page): ?Response
|
||||
{
|
||||
$started = hrtime(true);
|
||||
$response = $this->inner->dispatch($page);
|
||||
$durationMs = (hrtime(true) - $started) / 1_000_000;
|
||||
|
||||
$request = request();
|
||||
if ($request instanceof Request) {
|
||||
$request->attributes->set('http.ssr_ms', round($durationMs, 1));
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user