This commit is contained in:
Your Name
2026-10-23 11:39:56 +08:00
parent 86476920cf
commit ff98014fa2
11 changed files with 766 additions and 20 deletions
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace app\adminapi\service;
use app\common\service\DifyStreamTiming;
use think\facade\Log;
/** A request-local, patient-free timing record for the diagnosis assistant SSE path. */
@@ -91,4 +92,15 @@ final class AssistantSseTiming
// Telemetry must never interrupt the clinical request.
}
}
/** The typed collector exposes only bounded numeric timing and enum metadata. */
public function logUpstream(DifyStreamTiming $upstream): void
{
try {
Log::write('diagnosis ai upstream stages ' . json_encode([
'trace_id' => $this->traceId, 'request_elapsed_ms' => self::elapsedMs($this->startedAt),
'timing' => $upstream->snapshot(),
]), 'info');
} catch (\Throwable $ignored) {}
}
}