Workflow Monitoring

Production workflows need robust observability. ContractSpec provides SLA monitoring, distributed tracing, and audit logging out of the box.

SLA Monitoring

Use the SLAMonitor to detect when workflows or individual steps exceed their budgeted duration.

import { SLAMonitor } from '@lssm/lib.contracts/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);

Telemetry & Tracing

Workflows automatically generate OpenTelemetry spans for:

  • Overall workflow execution
  • Individual steps
  • Retries and compensation

Configure your OpenTelemetry exporter to send traces to Jaeger, Datadog, or Honeycomb.

Dashboarding

You can build a custom dashboard using DataViews over your workflow state database. See the DataViews tutorial for how to visualize WorkflowState records.