import { NextResponse } from "next/server"; import { prisma } from "@/lib/prisma"; export async function GET() { try { const [totalTraces, totalSpans, totalDecisions, totalEvents] = await Promise.all([ prisma.trace.count(), prisma.span.count(), prisma.decisionPoint.count(), prisma.event.count(), ]); return NextResponse.json( { totalTraces, totalSpans, totalDecisions, totalEvents }, { status: 200 } ); } catch (error) { console.error("Error fetching stats:", error); return NextResponse.json( { error: "Internal server error" }, { status: 500 } ); } }