{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dashboard-05",
  "title": "DevOps dashboard",
  "description": "A DevOps dashboard: live throughput, delivery performance, response time percentiles, open alerts, uptime, build health and recent deployments, filtered by service.",
  "registryDependencies": [
    "https://www.dashboardblocks.com/r/radix/alerts-01.json",
    "https://www.dashboardblocks.com/r/radix/block-state.json",
    "https://www.dashboardblocks.com/r/radix/chart-panel-06.json",
    "https://www.dashboardblocks.com/r/radix/dashboard-header.json",
    "https://www.dashboardblocks.com/r/radix/deployments.json",
    "https://www.dashboardblocks.com/r/radix/deployments-01.json",
    "https://www.dashboardblocks.com/r/radix/deployments-03.json",
    "https://www.dashboardblocks.com/r/radix/deployments-04.json",
    "https://www.dashboardblocks.com/r/radix/realtime-02.json",
    "https://www.dashboardblocks.com/r/radix/status.json",
    "https://www.dashboardblocks.com/r/radix/status-02.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/dashboards/dashboard-05.tsx",
      "content": "'use client'\n\nimport {\n  Alerts1,\n  type Alerts1Props,\n} from '@/registry/components/dashboardblocks/alerts/alerts-01'\nimport {\n  BlockBusy,\n  BlockStateProvider,\n  type BlockStateProps,\n} from '@/registry/components/dashboardblocks/block-state'\nimport { ChartPanel6 } from '@/registry/components/dashboardblocks/chart-panel/chart-panel-06'\nimport {\n  type DateRangePreset,\n  DateRangePicker,\n  ExportMenu,\n  FilterChip,\n  FilterMenu,\n  getDateRange,\n  getPreset,\n  getPreviousRange,\n} from '@/registry/components/dashboardblocks/dashboard-header'\nimport type { DeployStatus } from '@/registry/components/dashboardblocks/deployments'\nimport {\n  type Deployment,\n  Deployments1,\n} from '@/registry/components/dashboardblocks/deployments/deployments-01'\nimport { Deployments3 } from '@/registry/components/dashboardblocks/deployments/deployments-03'\nimport { Deployments4 } from '@/registry/components/dashboardblocks/deployments/deployments-04'\nimport { Realtime2 } from '@/registry/components/dashboardblocks/realtime/realtime-02'\nimport type { StatusLevel, UptimeDay } from '@/registry/components/dashboardblocks/status'\nimport { Status2 } from '@/registry/components/dashboardblocks/status/status-02'\nimport { IconPlaceholder } from '@/registry/icons/icon-placeholder'\nimport {\n  formatDate,\n  formatDateRange,\n  formatNumber,\n} from '@/registry/lib/dashboardblocks/format'\nimport { useEffect, useState } from 'react'\n\ninterface Dashboard5Props extends BlockStateProps {\n  empty?: boolean\n  title: string\n  /** The last day of every date range. */\n  today: Date\n}\n\nconst exampleProps: Dashboard5Props = {\n  title: 'Platform health',\n  today: new Date(Date.UTC(2026, 8, 25)),\n}\n\nconst DAY = 86_400_000\nconst HOUR = 3_600_000\nconst MINUTE = 60_000\nconst NOW_HOURS = 15\n\nconst SERVICES = [\n  {\n    changeFailureRate: 0.06,\n    deploysPerDay: 4.2,\n    latency: { p50: 48, p95: 128, p99: 246 },\n    leadTimeHours: 14,\n    name: 'Web app',\n    restoreHours: 1.2,\n    share: 0.45,\n  },\n  {\n    changeFailureRate: 0.09,\n    deploysPerDay: 2.8,\n    latency: { p50: 64, p95: 152, p99: 310 },\n    leadTimeHours: 22,\n    name: 'API',\n    restoreHours: 2.1,\n    share: 0.35,\n  },\n  {\n    changeFailureRate: 0.04,\n    deploysPerDay: 0.6,\n    latency: { p50: 96, p95: 262, p99: 488 },\n    leadTimeHours: 46,\n    name: 'Payments',\n    restoreHours: 3.4,\n    share: 0.08,\n  },\n  {\n    changeFailureRate: 0.12,\n    deploysPerDay: 1.1,\n    latency: { p50: 38, p95: 112, p99: 214 },\n    leadTimeHours: 30,\n    name: 'Webhooks',\n    restoreHours: 0.8,\n    share: 0.12,\n  },\n]\n\ntype Service = (typeof SERVICES)[number]\ntype Percentile = keyof Service['latency']\n\nconst INCIDENTS: {\n  daysAgo: number\n  note: string\n  service: string\n  slowdown: number\n  status: StatusLevel\n  uptime: number\n}[] = [\n  {\n    daysAgo: 0,\n    note: 'Elevated error rate in eu-west-1',\n    service: 'API',\n    slowdown: 1.15,\n    status: 'partial',\n    uptime: 99.2,\n  },\n  {\n    daysAgo: 0,\n    note: 'Slow responses in us-east-1',\n    service: 'Web app',\n    slowdown: 2.2,\n    status: 'degraded',\n    uptime: 99.8,\n  },\n  {\n    daysAgo: 3,\n    note: 'Elevated 5xx errors for 42 min',\n    service: 'API',\n    slowdown: 1.9,\n    status: 'partial',\n    uptime: 97.1,\n  },\n  {\n    daysAgo: 4,\n    note: 'Increased latency',\n    service: 'API',\n    slowdown: 1.3,\n    status: 'degraded',\n    uptime: 99.6,\n  },\n  {\n    daysAgo: 12,\n    note: 'Slow page loads in EU for 25 min',\n    service: 'Web app',\n    slowdown: 1.4,\n    status: 'degraded',\n    uptime: 99.4,\n  },\n  {\n    daysAgo: 20,\n    note: 'Delayed deliveries for 18 min',\n    service: 'Webhooks',\n    slowdown: 1.5,\n    status: 'degraded',\n    uptime: 99.7,\n  },\n  {\n    daysAgo: 31,\n    note: 'Full outage for 1 h 6 min',\n    service: 'API',\n    slowdown: 2.4,\n    status: 'major',\n    uptime: 95.4,\n  },\n  {\n    daysAgo: 38,\n    note: 'Card processor timeouts for 31 min',\n    service: 'Payments',\n    slowdown: 2.1,\n    status: 'partial',\n    uptime: 97.9,\n  },\n  {\n    daysAgo: 47,\n    note: 'Scheduled database upgrade',\n    service: 'Web app',\n    slowdown: 1,\n    status: 'maintenance',\n    uptime: 100,\n  },\n  {\n    daysAgo: 66,\n    note: 'Increased latency',\n    service: 'API',\n    slowdown: 1.3,\n    status: 'degraded',\n    uptime: 99.8,\n  },\n]\n\nconst ALERTS: (Omit<NonNullable<Alerts1Props['alerts']>[number], 'firedAt'> & {\n  minutesAgo: number\n})[] = [\n  {\n    id: 'a1',\n    minutesAgo: 4,\n    service: 'API',\n    region: 'eu-west-1',\n    severity: 'critical',\n    title: 'Error rate above 5% for 10 minutes',\n  },\n  {\n    id: 'a2',\n    minutesAgo: 18,\n    service: 'Payments',\n    severity: 'critical',\n    title: 'Queue backlog over 10,000 jobs',\n  },\n  {\n    id: 'a3',\n    minutesAgo: 52,\n    service: 'Web app',\n    region: 'us-east-1',\n    severity: 'warning',\n    title: 'p95 response time above 250 ms',\n  },\n  {\n    acknowledged: true,\n    id: 'a4',\n    minutesAgo: 135,\n    service: 'API',\n    severity: 'warning',\n    title: 'Disk usage above 80%',\n  },\n  {\n    id: 'a5',\n    minutesAgo: 210,\n    service: 'Webhooks',\n    severity: 'warning',\n    title: 'Retry queue growing for 30 minutes',\n  },\n  {\n    id: 'a6',\n    minutesAgo: 310,\n    service: 'Payments',\n    severity: 'info',\n    title: 'Nightly invoice run took 2× longer than usual',\n  },\n]\n\nconst PIPELINES = [\n  {\n    medianDuration: 412,\n    name: 'web-app',\n    runs: 'sssssfsssssssssssssfssssssssss',\n    service: 'Web app',\n  },\n  {\n    medianDuration: 2_904,\n    name: 'web-e2e',\n    runs: 'ssfssffsssfsssssffssssfsssfsss',\n    service: 'Web app',\n  },\n  {\n    medianDuration: 538,\n    name: 'api',\n    runs: 'sssssssssfssssssssssssssssssss',\n    service: 'API',\n  },\n  {\n    medianDuration: 1_126,\n    name: 'api-e2e',\n    runs: 'ssssssssssssssssssffssssssssss',\n    service: 'API',\n  },\n  {\n    medianDuration: 1_386,\n    name: 'payments',\n    runs: 'sssssssssssssssssssssssssssssr',\n    service: 'Payments',\n  },\n  {\n    medianDuration: 244,\n    name: 'webhooks',\n    runs: 'sssfssssssssssfssssssssssfssss',\n    service: 'Webhooks',\n  },\n]\n\nconst RUN_STATUS: Record<string, DeployStatus> = {\n  f: 'failed',\n  r: 'running',\n  s: 'success',\n}\n\nconst DEPLOYMENTS: (Omit<Deployment, 'environment' | 'startedAt'> & {\n  environment: string\n  minutesAgo: number\n  service: string\n})[] = [\n  {\n    author: 'Ana Lima',\n    duration: 94,\n    environment: 'Production',\n    id: 'd1',\n    message: 'Fix currency rounding on invoices',\n    minutesAgo: 2,\n    service: 'Payments',\n    sha: '9f3c2a17b',\n    status: 'running',\n  },\n  {\n    author: 'Kevin Moore',\n    duration: 187,\n    environment: 'Production',\n    id: 'd2',\n    message: 'Add retry to webhook delivery',\n    minutesAgo: 38,\n    service: 'Webhooks',\n    sha: '41be08d3c',\n    status: 'success',\n  },\n  {\n    author: 'Sara Okafor',\n    duration: 66,\n    environment: 'Production',\n    id: 'd3',\n    message: 'Upgrade image pipeline',\n    minutesAgo: 95,\n    service: 'Web app',\n    sha: 'c07d9e412',\n    status: 'rolled-back',\n  },\n  {\n    author: 'Diego Alvarez',\n    duration: 241,\n    environment: 'Staging',\n    id: 'd4',\n    message: 'Paginate the audit log endpoint',\n    minutesAgo: 130,\n    service: 'API',\n    sha: '7a21f0c95',\n    status: 'failed',\n  },\n  {\n    author: 'Sara Okafor',\n    duration: 143,\n    environment: 'Production',\n    id: 'd5',\n    message: 'Cache pricing page for 60 seconds',\n    minutesAgo: 205,\n    service: 'Web app',\n    sha: 'e5d8b3a01',\n    status: 'success',\n  },\n  {\n    author: 'Mei Tanaka',\n    duration: 198,\n    environment: 'Production',\n    id: 'd6',\n    message: 'Rate limit token refresh',\n    minutesAgo: 280,\n    service: 'API',\n    sha: '3c9e17d44',\n    status: 'success',\n  },\n  {\n    author: 'Kevin Moore',\n    duration: 172,\n    environment: 'Staging',\n    id: 'd7',\n    message: 'Sign webhook payloads with rotating keys',\n    minutesAgo: 410,\n    service: 'Webhooks',\n    sha: 'b82f6e0d7',\n    status: 'success',\n  },\n  {\n    author: 'Ana Lima',\n    duration: 305,\n    environment: 'Production',\n    id: 'd8',\n    message: 'Retry declined cards once after 3DS',\n    minutesAgo: 1_520,\n    service: 'Payments',\n    sha: '5e0a93c62',\n    status: 'success',\n  },\n]\n\ninterface Query {\n  preset: DateRangePreset\n  service: string | null\n}\n\nconst LATENCY_SLO_MS = 200\n\nconst ms = (value: number) => `${formatNumber(value, { maximumFractionDigits: 0 })} ms`\n\nfunction weigh(services: Service[], value: (service: Service) => number) {\n  const total = services.reduce((sum, service) => sum + service.share, 0)\n  return (\n    services.reduce((sum, service) => sum + service.share * value(service), 0) / total\n  )\n}\n\nfunction latencyAt(\n  service: Service,\n  percentile: Percentile,\n  daysAgo: number,\n  hour?: number,\n) {\n  const incident = INCIDENTS.find(\n    (item) => item.service === service.name && item.daysAgo === daysAgo,\n  )\n  const load =\n    hour === undefined\n      ? 1 + Math.sin(daysAgo / 4 + service.share * 10) * 0.07\n      : 0.82 + Math.sin(((hour - 8) / 24) * Math.PI * 2) * 0.18\n  const drift = 1 + daysAgo * 0.0012\n  return service.latency[percentile] * load * drift * (incident?.slowdown ?? 1)\n}\n\nfunction deliveryAt(service: Service, daysAgo: number, today: Date) {\n  const weekday = new Date(today.getTime() - daysAgo * DAY).getUTCDay()\n  const weekend = weekday === 0 || weekday === 6\n  const wobble = Math.sin(daysAgo / 6 + service.share * 7)\n  const drift = 1 + daysAgo * 0.004\n  const deploys = service.deploysPerDay * (weekend ? 0.2 : 1.32) * (1 + wobble * 0.15)\n  return {\n    changeFailureRate: service.changeFailureRate * (1 + wobble * 0.2) * drift,\n    deploys,\n    leadTimeHours: service.leadTimeHours * (1 - wobble * 0.1) * drift,\n    restoreHours: service.restoreHours * (1 + wobble * 0.25) * drift,\n  }\n}\n\nfunction doraFor(services: Service[], days: number, shift: number, today: Date) {\n  let deploys = 0\n  let failures = 0\n  let leadTime = 0\n  let restore = 0\n  for (const service of services) {\n    for (let daysAgo = shift; daysAgo < shift + days; daysAgo++) {\n      const day = deliveryAt(service, daysAgo, today)\n      deploys += day.deploys\n      failures += day.deploys * day.changeFailureRate\n      leadTime += day.deploys * day.leadTimeHours\n      restore += day.deploys * day.changeFailureRate * day.restoreHours\n    }\n  }\n  return {\n    changeFailureRate: failures / deploys,\n    deploysPerDay: deploys / days,\n    leadTimeHours: leadTime / deploys,\n    restoreHours: restore / failures,\n  }\n}\n\nfunction uptimeDays(service: string, today: Date): UptimeDay[] {\n  return Array.from({ length: 90 }, (_, index) => {\n    const daysAgo = 89 - index\n    const incident = INCIDENTS.find(\n      (item) => item.service === service && item.daysAgo === daysAgo,\n    )\n    return {\n      label: formatDate(new Date(today.getTime() - daysAgo * DAY), 'date'),\n      note: incident?.note,\n      status: incident?.status ?? 'operational',\n      uptime: incident?.uptime ?? 100,\n    }\n  })\n}\n\nfunction buildOpsData({ preset, service }: Query, today: Date) {\n  const hourly = preset === 'today'\n  const days = getPreset(preset).days\n  const range = getDateRange(preset, today)\n  const previousRange = getPreviousRange(range)\n  const services = service ? SERVICES.filter((item) => item.name === service) : SERVICES\n\n  const point = (daysAgo: number, hour?: number) => ({\n    p50: Math.round(weigh(services, (item) => latencyAt(item, 'p50', daysAgo, hour))),\n    p95: Math.round(weigh(services, (item) => latencyAt(item, 'p95', daysAgo, hour))),\n    p99: Math.round(weigh(services, (item) => latencyAt(item, 'p99', daysAgo, hour))),\n  })\n  const latency = hourly\n    ? Array.from({ length: NOW_HOURS + 1 }, (_, hour) => ({\n        label: `${String(hour).padStart(2, '0')}:00`,\n        ...point(0, hour),\n      }))\n    : Array.from({ length: days }, (_, index) => {\n        const daysAgo = days - 1 - index\n        return {\n          label: formatDate(new Date(today.getTime() - daysAgo * DAY), 'day'),\n          ...point(daysAgo),\n        }\n      })\n  const latencyPrevious = hourly ? point(1, NOW_HOURS).p95 : point(1).p95\n\n  const now = new Date(today.getTime() + NOW_HOURS * HOUR)\n  const matches = (item: { service: string }) => !service || item.service === service\n\n  return {\n    alerts: ALERTS.filter(matches).map(({ minutesAgo, ...alert }) => ({\n      ...alert,\n      firedAt: new Date(now.getTime() - minutesAgo * MINUTE),\n    })),\n    deployments: DEPLOYMENTS.filter(matches)\n      .slice(0, 6)\n      .map(({ environment, minutesAgo, service: name, ...deployment }) => ({\n        ...deployment,\n        environment: service ? environment : `${name} ${environment.toLowerCase()}`,\n        startedAt: new Date(now.getTime() - minutesAgo * MINUTE),\n      })),\n    dora: {\n      current: doraFor(services, days, 0, today),\n      previous: doraFor(services, days, days, today),\n    },\n    latency,\n    latencyPrevious,\n    now,\n    pipelines: PIPELINES.filter(matches).map((pipeline) => ({\n      medianDuration: pipeline.medianDuration,\n      name: pipeline.name,\n      runs: pipeline.runs.split('').map((run) => RUN_STATUS[run]),\n    })),\n    previousLabel: hourly ? 'yesterday' : formatDateRange(previousRange),\n    uptime: services.map((item) => ({\n      days: uptimeDays(item.name, today),\n      name: item.name,\n    })),\n  }\n}\n\nconst THROUGHPUT = Array.from({ length: 60 }, (_, index) => {\n  const wave = index % 28 < 14 ? index % 14 : 14 - (index % 14)\n  const requests = 780 + wave * 16 + ((index * 37) % 11) * 9\n  return { errors: Math.round(requests * (index % 17 === 5 ? 0.021 : 0.0018)), requests }\n})\n\nconst Dashboard5 = (props: Dashboard5Props) => {\n  const { empty = false, errorMessage, status, title, today } = props\n  const [query, setQuery] = useState<Query>({ preset: '30d', service: null })\n  const [displayedQuery, setDisplayedQuery] = useState(query)\n  const busy = displayedQuery !== query\n\n  useEffect(() => {\n    if (displayedQuery === query) return\n    const timer = setTimeout(() => setDisplayedQuery(query), 500)\n    return () => clearTimeout(timer)\n  }, [query, displayedQuery])\n\n  const update = (patch: Partial<Query>) =>\n    setQuery((current) => ({ ...current, ...patch }))\n  const data = buildOpsData(displayedQuery, today)\n  const range = getDateRange(query.preset, today)\n\n  return (\n    <BlockStateProvider\n      errorMessage={errorMessage}\n      state={status ?? (empty ? 'empty' : undefined)}\n    >\n      <div className='@container flex w-full flex-col gap-8'>\n        <header className='flex flex-col gap-2'>\n          <div className='flex flex-wrap items-start justify-between gap-3'>\n            <h1 className='min-w-0 text-2xl font-semibold tracking-tight'>{title}</h1>\n            <ExportMenu disabled={status !== undefined || empty} onExport={() => {}} />\n          </div>\n          <div className='flex flex-wrap items-center justify-between gap-x-4 gap-y-2'>\n            <p className='text-muted-foreground min-w-0 leading-relaxed'>\n              Showing{' '}\n              <DateRangePicker\n                onValueChange={(preset) => update({ preset })}\n                today={today}\n                value={query.preset}\n                variant='inline'\n              />\n              <span aria-live='polite'>\n                , {formatDateRange(range)}, compared with{' '}\n                {formatDateRange(getPreviousRange(range))}.\n              </span>\n            </p>\n            <div className='flex flex-wrap items-center gap-2'>\n              {query.service && (\n                <FilterChip\n                  field='Service'\n                  value={query.service}\n                  onRemove={() => update({ service: null })}\n                />\n              )}\n              <FilterMenu\n                allLabel='All services'\n                label='Service'\n                onValueChange={(service) => update({ service })}\n                options={SERVICES.map((item) => item.name)}\n                value={query.service}\n              >\n                <IconPlaceholder\n                  lucide='ServerIcon'\n                  tabler='IconServer'\n                  hugeicons='ServerStack01Icon'\n                  phosphor='HardDrivesIcon'\n                  remixicon='RiServerLine'\n                />\n                {query.service ? 'Change service' : 'Filter by service'}\n              </FilterMenu>\n            </div>\n          </div>\n        </header>\n        <div className='flex flex-col gap-4'>\n          <Realtime2\n            errorMessage={errorMessage}\n            status={status}\n            description='Requests per second across every service, over the last 5 minutes.'\n            samples={empty ? [] : THROUGHPUT}\n            title='Throughput'\n          />\n          <BlockBusy\n            busy={busy}\n            label='Updating the dashboard'\n            className='grid gap-4 @4xl:grid-cols-3'\n          >\n            <div className='grid @4xl:col-span-3'>\n              <Deployments3\n                errorMessage={errorMessage}\n                status={status}\n                comparison={\n                  displayedQuery.preset === 'today'\n                    ? 'yesterday'\n                    : `in the ${getPreset(displayedQuery.preset).days} days before`\n                }\n                current={empty ? undefined : data.dora.current}\n                previous={empty ? undefined : data.dora.previous}\n                title='Delivery performance'\n              />\n            </div>\n            <div className='grid @4xl:col-span-2'>\n              <ChartPanel6\n                errorMessage={errorMessage}\n                status={status}\n                comparison={\n                  displayedQuery.preset === 'today'\n                    ? 'this time yesterday'\n                    : 'the day before'\n                }\n                data={empty ? [] : data.latency}\n                description='Half of all requests finish within p50, and all but the slowest 1% within p99.'\n                formatter={ms}\n                headline='p95'\n                labelHeading={displayedQuery.preset === 'today' ? 'Hour' : 'Day'}\n                limit={{ label: 'SLO', value: LATENCY_SLO_MS }}\n                percentiles={[\n                  { key: 'p50', label: 'p50' },\n                  { key: 'p95', label: 'p95' },\n                  { key: 'p99', label: 'p99' },\n                ]}\n                previous={empty ? undefined : data.latencyPrevious}\n                title='Response time'\n              />\n            </div>\n            <Alerts1\n              errorMessage={errorMessage}\n              status={status}\n              alerts={empty ? [] : data.alerts}\n              now={data.now}\n              title='Open alerts'\n            />\n            <div className='grid @4xl:col-span-2'>\n              <Status2\n                errorMessage={errorMessage}\n                status={status}\n                services={empty ? [] : data.uptime}\n                title='Uptime, last 90 days'\n              />\n            </div>\n            <Deployments4\n              errorMessage={errorMessage}\n              status={status}\n              pipelines={empty ? [] : data.pipelines}\n              title='Build health'\n            />\n            <div className='grid @4xl:col-span-3'>\n              <Deployments1\n                errorMessage={errorMessage}\n                status={status}\n                deployments={empty ? [] : data.deployments}\n                now={data.now}\n                title='Recent deployments'\n              />\n            </div>\n          </BlockBusy>\n        </div>\n      </div>\n    </BlockStateProvider>\n  )\n}\n\nexport { Dashboard5, exampleProps as dashboard5ExampleProps, type Dashboard5Props }\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/dashboards/dashboard-05.tsx"
    }
  ],
  "meta": {
    "shows": "A full DevOps dashboard with live throughput, delivery performance, response times, open alerts, uptime and recent deployments.",
    "size": "page",
    "usedWith": [],
    "component": "Dashboard5",
    "props": "{ empty?: boolean; title: string; today: Date; errorMessage?: string; status?: \"loading\" | \"error\" }"
  },
  "type": "registry:block"
}
