// @bun
import{CodeBlock as a,InstallCommand as i}from"@contractspec/lib.design-system";import o from"@contractspec/lib.ui-link";import{ChevronRight as r}from"lucide-react";import{jsx as e,jsxs as t}from"react/jsx-runtime";function c(){return t("div",{className:"space-y-8",children:[t("div",{className:"space-y-4",children:[e("h1",{className:"font-bold text-4xl",children:"SLO Library"}),t("p",{className:"text-lg text-muted-foreground",children:[e("code",{children:"@contractspec/lib.slo"})," keeps service level objectives front and center\u2014declarative definitions, rolling snapshots, burn-rate math, and automated incidents."]})]}),t("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Installation"}),e(i,{package:"@contractspec/lib.slo"})]}),t("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Define Targets"}),e(a,{language:"typescript",code:`const definition: SLODefinition = {
  id: 'billing.createInvoice.availability',
  targetAvailability: 0.999,
  latencyP99TargetMs: 500,
  rollingWindowMs: 7 * 24 * 60 * 60 * 1000,
  alerts: { fastBurnThreshold: 14, slowBurnThreshold: 6 },
};`})]}),t("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Monitor Burn Rate"}),e(a,{language:"typescript",code:`const monitor = new SLOMonitor({ definition, incidentManager });
const { snapshot, burnRate } = monitor.recordWindow({
  good: 12500,
  bad: 3,
  latencyP99: 420,
  latencyP95: 210,
});`}),t("p",{className:"text-muted-foreground text-sm",children:["When burn rate exceeds the configured thresholds the monitor calls your",e("code",{children:"IncidentManager"}),", providing the snapshot that triggered the alert."]})]}),t("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"History & Reporting"}),e("p",{className:"text-muted-foreground text-sm",children:"`SLOTracker.getHistory()` returns the latest snapshots so dashboards can show trends without hitting a warehouse. Prisma models persist everything for long-term audits."})]}),t("div",{className:"flex items-center gap-4 pt-4",children:[e(o,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),t(o,{href:"/docs/libraries/cost-tracking",className:"btn-primary",children:["Next: Cost Tracking ",e(r,{size:16})]})]})]})}export{c as LibrariesSLOPage};
