Skip to content
Open
Show file tree
Hide file tree
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
25 changes: 25 additions & 0 deletions src/app/admin/api/requests/hooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use client';

import { useTRPC } from '@/lib/trpc/utils';
import { useQuery } from '@tanstack/react-query';

type RequestLogsListParams = {
page: number;
limit: number;
sortBy: 'created_at' | 'status_code' | 'provider' | 'model';
sortOrder: 'asc' | 'desc';
requestId?: string;
search?: string;
fromDate?: string;
toDate?: string;
provider?: string;
statusCode?: number;
kiloUserId?: string;
organizationId?: string;
model?: string;
};

export function useRequestLogsList(params: RequestLogsListParams) {
const trpc = useTRPC();
return useQuery(trpc.admin.requestLogs.list.queryOptions(params));
}
6 changes: 6 additions & 0 deletions src/app/admin/components/AppSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
UserX,
Upload,
Bell,
ScrollText,
} from 'lucide-react';
import { useSession } from 'next-auth/react';
import type { Session } from 'next-auth';
Expand Down Expand Up @@ -159,6 +160,11 @@ const analyticsObservabilityItems: MenuItem[] = [
url: '/admin/alerting-ttfb',
icon: () => <Bell />,
},
{
title: () => 'Request Logs',
url: '/admin/requests',
icon: () => <ScrollText />,
},
];

const menuSections: MenuSection[] = [
Expand Down
Loading