AI/ML
Retry Count Card - Request Reliability
Monitor retry counts and request reliability metrics. Track failed requests and retry patterns for system resilience analysis.
Retry Count Card
The Retry Count Card tracks the number of retry attempts for failed inference requests, helping teams identify reliability issues.
Preview
Installation
npx shadcn@latest add https://vectormotion.vercel.app/registry/retry-count-card.jsonRetry Count Card
'use client'import React from 'react';import { RefreshCw } from 'lucide-react';import { motion } from 'motion/react';import { clsx, type ClassValue } from "clsx"import { twMerge } from "tailwind-merge"import { ResponsiveContainer, BarChart, Bar, Tooltip, Cell } from 'recharts';function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs))}interface RetryData { hour: string; count: number; [key: string]: any;}interface RetryCountCardProps { className?: string; title?: string; retryCount?: number; retryLabel?: string; data?: RetryData[]; footerText?: string;}const DEFAULT_DATA: RetryData[] = [ { hour: '1h', count: 2 }, { hour: '2h', count: 5 }, { hour: '3h', count: 1 }, { hour: '4h', count: 8 }, { hour: '5h', count: 3 }, { hour: '6h', count: 0 }, { hour: '7h', count: 4 }, { hour: '8h', count: 2 },];const DEFAULT_TITLE = "Retries";const DEFAULT_RETRY_COUNT = 25;const DEFAULT_RETRY_LABEL = "events";const DEFAULT_FOOTER_TEXT = "Last 8 Hours";export const RetryCountCard: React.FC<RetryCountCardProps> = ({ className = "", title = DEFAULT_TITLE, retryCount = DEFAULT_RETRY_COUNT, retryLabel = DEFAULT_RETRY_LABEL, data = DEFAULT_DATA, footerText = DEFAULT_FOOTER_TEXT,}) => { return ( <motion.div initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.5, delay: 0.2 }} className={cn( "relative overflow-hidden rounded-2xl border border-border bg-card text-card-foreground shadow-sm transition-all hover:border-cyan-300 dark:hover:border-cyan-700 hover:shadow-md flex flex-col h-full", className )} > <div className="p-5 flex flex-col h-full relative z-10"> <div className="mb-4 flex items-start justify-between"> <div> <h3 className="font-bold text-lg text-foreground"> {title} </h3> <div className="flex items-center gap-2 mt-1"> <span className="text-2xl font-bold text-foreground">{retryCount}</span> <span className="text-xs font-medium text-muted-foreground"> {retryLabel} </span> </div> </div> <div className="rounded-lg border-2 border-cyan-100 dark:border-cyan-800 p-2 text-cyan-500 dark:text-cyan-400 flex items-center justify-center"> <RefreshCw className="h-5 w-5" /> </div> </div> <div className="flex-1 w-full min-h-[100px] relative"> <ResponsiveContainer width="100%" height="100%"> <BarChart data={data}> <Tooltip cursor={{ fill: 'transparent' }} content={() => null} /> <Bar dataKey="count" radius={[2, 2, 0, 0]}> {data.map((entry, index) => ( <Cell key={`cell-${index}`} fill={entry.count > 4 ? '#06b6d4' : '#a5f3fc'} /> ))} </Bar> </BarChart> </ResponsiveContainer> <div className="text-center text-[10px] text-muted-foreground mt-1">{footerText}</div> </div> <div className="absolute -bottom-4 -right-4 z-0 opacity-5 pointer-events-none"> <RefreshCw className="w-40 h-40 text-cyan-500" /> </div> </div> </motion.div> );};Props
Prop
Type
Usage
This component is a demo card displaying retry count metrics with animated visualizations and dark mode support.