var i=Object.defineProperty;var l=(o)=>o;function c(o,t){this[o]=l.bind(null,t)}var d=(o,t)=>{for(var r in t)i(o,r,{get:t[r],enumerable:!0,configurable:!0,set:c.bind(t,r)})};var n=(o,t)=>()=>(o&&(t=o(o=0)),t);import{jsx as e,jsxs as a}from"react/jsx-runtime";function s(){return a("div",{className:"space-y-8",children:[a("div",{className:"space-y-4",children:[e("h1",{className:"font-bold text-4xl",children:"Workflow Monitoring"}),e("p",{className:"text-lg text-muted-foreground",children:"Production workflows need robust observability. ContractSpec provides SLA monitoring, distributed tracing, and audit logging out of the box."})]}),a("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"SLA Monitoring"}),a("p",{children:["Use the ",e("code",{children:"SLAMonitor"})," to detect when workflows or individual steps exceed their budgeted duration."]}),e("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`import { SLAMonitor } from '@contractspec/lib.contracts-spec/workflow/sla-monitor';

const monitor = new SLAMonitor((event, payload) => {
  if (event === 'workflow.sla_breach') {
    console.error('SLA Breach!', payload);
    // Send to PagerDuty / Slack
  }
});

// Check periodically
monitor.check(currentState, workflowSpec);`})]}),a("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Telemetry & Tracing"}),e("p",{children:"Workflows automatically generate OpenTelemetry spans for:"}),a("ul",{className:"list-disc space-y-2 pl-6",children:[e("li",{children:"Overall workflow execution"}),e("li",{children:"Individual steps"}),e("li",{children:"Retries and compensation"})]}),e("p",{children:"Configure your OpenTelemetry exporter to send traces to Jaeger, Datadog, or Honeycomb."})]}),a("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Dashboarding"}),a("p",{children:["You can build a custom dashboard using ",e("code",{children:"DataViews"})," over your workflow state database. See the DataViews tutorial for how to visualize ",e("code",{children:"WorkflowState"})," records."]})]})]})}export{s as AdvancedWorkflowMonitoringPage};
