Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Http/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ protected function getDashboardStats(): array
->selectRaw("
SUM(COALESCE(db_query_count, 0)) as db_queries,
SUM(COALESCE(cache_hit_count, 0) + COALESCE(cache_miss_count, 0)) as cache_calls,
SUM(CASE WHEN http_calls IS NOT NULL AND http_calls != '[]' AND http_calls != 'null' THEN 1 ELSE 0 END) as http_calls,
SUM(CASE WHEN mail_calls IS NOT NULL AND mail_calls != '[]' AND mail_calls != 'null' THEN 1 ELSE 0 END) as mail_calls
SUM(CASE WHEN http_calls IS NOT NULL AND http_calls::text != '[]' AND http_calls::text != 'null' THEN 1 ELSE 0 END) as http_calls,
SUM(CASE WHEN mail_calls IS NOT NULL AND mail_calls::text != '[]' AND mail_calls::text != 'null' THEN 1 ELSE 0 END) as mail_calls
")
->first();

Expand Down Expand Up @@ -173,13 +173,13 @@ public function generatePrompt(string $id, AiPromptService $promptService): Json

public function stats(): JsonResponse
{
$stats = Trace::selectRaw('
$stats = Trace::selectRaw("
count(*) as total,
count(case when status = "error" then 1 end) as failed,
count(case when status = "success" then 1 end) as success,
count(case when status = 'error' then 1 end) as failed,
count(case when status = 'success' then 1 end) as success,
avg(duration_ms) as avg_duration,
max(duration_ms) as slowest
')->first();
")->first();

$today = Trace::whereDate('started_at', now()->today())->count();

Expand Down
Loading