Skip to content
reaatechREAATECH

@reaatech/agent-runbook-alerts

npm v0.1.0

Extracts existing monitoring configurations and generates new SLO-based, resource, and application alert definitions for Prometheus, Datadog, and CloudWatch. It provides a collection of utility functions for parsing alert rules, calculating threshold recommendations, and formatting output for specific monitoring platforms.

@reaatech/agent-runbook-alerts

npm version License: MIT CI

Alert extraction and generation for the Agent Runbook Generator. Extracts existing alert definitions from monitoring configs and generates new SLO-based, resource, and application alerts for Prometheus, Datadog, and CloudWatch.

Installation

terminal
npm install @reaatech/agent-runbook-alerts
# or
pnpm add @reaatech/agent-runbook-alerts

Feature Overview

  • Alert extraction — finds existing alert rules in Prometheus, Datadog, and CloudWatch configs
  • SLO-based alerts — generates burn rate alerts from availability and latency targets
  • Resource alerts — CPU, memory, and disk saturation alerts with dynamic thresholds
  • Application alerts — error rate, request rate, and dependency failure alerts
  • Multi-platform formatting — output compatible with Prometheus, Datadog, and CloudWatch
  • Default alerts — sensible defaults for services with common dependency patterns

Quick Start

typescript
import { extractAlerts, generateAlerts, calculateSloThresholds } from "@reaatech/agent-runbook-alerts";
 
const existing = extractAlerts("/path/to/repo");
 
const alerts = generateAlerts(analysisContext, {
  sloTargets: { availability: 99.9, latencyP99: 500 },
  platform: "prometheus",
});
 
const thresholds = calculateSloThresholds({
  availability: 99.9,
  latencyP99: 500,
});

API Reference

Alert Extractor

FunctionSignature
extractAlerts(repoPath: string) => ExtractedAlerts
generateDefaultAlerts(serviceName: string, hasDatabase: boolean, hasCache: boolean, hasQueue: boolean) => AlertDefinition[]

Alert Generator

FunctionSignature
generateAlerts(context: AnalysisContext, config?: AlertGenerationConfig) => AlertDefinition[]
formatAlertsForPlatform(alerts: AlertDefinition[], platform: 'prometheus' | 'datadog' | 'cloudwatch') => string

Threshold Calculator

FunctionSignature
calculateSloThresholds(sloTargets: SLOTargets) => ThresholdRecommendation[]
calculateResourceThresholds() => ThresholdRecommendation[]
calculateBurnRateThresholds(sloTargets: SLOTargets) => ThresholdRecommendation[]
getDefaultThresholds() => ThresholdConfig[]
calculateDynamicThreshold(values: number[], multiplier?: number) => number

License

MIT