Draft SLO (Service Level Objective) definitions for services
npm install @tpmjs/tools-slo-draftDraft Service Level Objective (SLO) definitions for services with comprehensive documentation, error budgets, and alerting strategies.
``bash`
npm install @tpmjs/tools-slo-draft
`typescript
import { sloDraftTool } from '@tpmjs/tools-slo-draft';
// Use with Vercel AI SDK
const result = await sloDraftTool.execute({
serviceName: 'Payment API',
metrics: [
{
name: 'Availability',
target: 99.9,
window: '30d'
},
{
name: 'API Latency P99',
target: 95.0,
window: 'rolling 7 days'
},
{
name: 'Error Rate',
target: 99.5,
window: '30d'
}
]
});
console.log(result.slo); // Markdown formatted SLO document
console.log(result.summary); // Brief summary
console.log(result.metrics); // Processed metrics with severity
`
- serviceName (string, required): Name of the servicemetrics
- (array, required): Array of metric objects with:name
- (string): Metric name (e.g., "Availability", "Latency P99")target
- (number): Target percentage (0-100)window
- (string): Time window (e.g., "30d", "7 days", "rolling 30 days")
Returns an object with:
- slo (string): Comprehensive SLO document in markdown formatmetrics
- (array): Processed metrics with additional metadata:windowType
- Original name, target, window
- : 'rolling' or 'calendar'severity
- : 'critical' (≥99.9%), 'high' (≥99%), or 'medium' (<99%)summary
- (string): Brief summary of the SLOmetadata
- (object):serviceName
- : Service namecreatedAt
- : ISO timestamptotalMetrics
- : Total number of metricscriticalMetrics`: Number of critical severity metrics
-
- Automatic Severity Classification: Metrics are classified as critical, high, or medium based on targets
- Error Budget Calculation: Calculates allowed downtime for each metric
- Alerting Strategy: Provides burn rate-based alerting recommendations
- Window Type Detection: Automatically detects rolling vs calendar windows
- Comprehensive Documentation: Generates full SLO document with monitoring and review processes
The tool generates a markdown document including:
- SLO definitions with targets and allowed downtime
- Error budget policies
- Alerting strategies based on severity
- Review processes and schedules
- Links to related documentation
MIT