observability-designer
Use when adding metrics, logs and traces to a service, fixing noisy alerts or designing dashboards. Designs SLIs with slo_designer.py, tunes alerts with alert_optimizer.py and generates dashboards with dashboard_generator.py.
Install
npx skills add https://github.com/beginwithu/agent-skills/tree/main/skills/observability-designer
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install beginwithu-agent-skills@llmmart
git clone https://github.com/beginwithu/agent-skills.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole beginwithu/agent-skills collection as a plugin from our marketplace. Git is the plain clone.
README
Observability Designer
A comprehensive toolkit for designing production-ready observability strategies including SLI/SLO frameworks, alert optimization, and dashboard generation.
Overview
The Observability Designer skill provides three powerful Python scripts that help you create, optimize, and maintain observability systems:
- SLO Designer: Generate complete SLI/SLO frameworks with error budgets and burn rate alerts
- Alert Optimizer: Analyze and optimize existing alert configurations to reduce noise and improve effectiveness
- Dashboard Generator: Create comprehensive dashboard specifications with role-based layouts and drill-down paths
Quick Start
Prerequisites
- Python 3.7+
- No external dependencies required (uses Python standard library only)
Basic Usage
# Generate SLO framework for a service
python3 scripts/slo_designer.py --service-type api --criticality critical --user-facing true --service-name payment-service
# Optimize existing alerts
python3 scripts/alert_optimizer.py --input assets/sample_alerts.json --analyze-only
# Generate a dashboard specification
python3 scripts/dashboard_generator.py --service-type web --name "Customer Portal" --role sre
Scripts Documentation
SLO Designer (slo_designer.py)
Generates comprehensive SLO frameworks based on service characteristics.
Features
- Automatic SLI Selection: Recommends appropriate SLIs based on service type
- Target Setting: Suggests SLO targets based on service criticality
- Error Budget Calculation: Computes error budgets and burn rate thresholds
- Multi-Window Burn Rate Alerts: Generates 4-window burn rate alerting rules
- SLA Recommendations: Provides customer-facing SLA guidance
Usage Examples
# From service definition file
python3 scripts/slo_designer.py --input assets/sample_service_api.json --output slo_framework.json
# From command line parameters
python3 scripts/slo_designer.py \
--service-type api \
--criticality critical \
--user-facing true \
--service-name payment-service \
--output payment_slos.json
# Generate and display summary only
python3 scripts/slo_designer.py --input assets/sample_service_web.json --summary-only
Service Definition Format
{
"name": "payment-service",
"type": "api",
"criticality": "critical",
"user_facing": true,
"description": "Handles payment processing",
"team": "payments",
"environment": "production",
"dependencies": [
{
"name": "user-service",
"type": "api",
"criticality": "high"
}
]
}
Supported Service Types
- api: REST APIs, GraphQL services
- web: Web applications, SPAs
- database: Database services, data stores
- queue: Message queues, event streams
- batch: Batch processing jobs
- ml: Machine learning services
Criticality Levels
- critical: 99.99% availability, <100ms P95 latency, <0.1% error rate
- high: 99.9% availability, <200ms P95 latency, <0.5% error rate
- medium: 99.5% availability, <500ms P95 latency, <1% error rate
- low: 99% availability, <1s P95 latency, <2% error rate
Alert Optimizer (alert_optimizer.py)
Analyzes existing alert configurations and provides optimization recommendations.
Features
- Noise Detection: Identifies alerts with high false positive rates
- Coverage Analysis: Finds gaps in monitoring coverage
- Duplicate Detection: Locates redundant or overlapping alerts
- Threshold Analysis: Reviews alert thresholds for appropriateness
- Fatigue Assessment: Evaluates alert volume and routing
Usage Examples
# Analyze existing alerts
python3 scripts/alert_optimizer.py --input assets/sample_alerts.json --analyze-only
# Generate optimized configuration
python3 scripts/alert_optimizer.py \
--input assets/sample_alerts.json \
--output optimized_alerts.json
# Generate HTML report
python3 scripts/alert_optimizer.py \
--input assets/sample_alerts.json \
--report alert_analysis.html \
--format html
Alert Configuration Format
{
"alerts": [
{
"alert": "HighLatency",
"expr": "histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m])) > 0.5",
"for": "5m",
"labels": {
"severity": "warning",
"service": "payment-service"
},
"annotations": {
"summary": "High request latency detected",
"runbook_url": "https://runbooks.company.com/high-latency"
},
"historical_data": {
"fires_per_day": 2.5,
"false_positive_rate": 0.15
}
}
],
"services": [
{
"name": "payment-service",
"criticality": "critical"
}
]
}
Analysis Categories
- Golden Signals: Latency, traffic, errors, saturation
- Resource Utilization: CPU, memory, disk, network
- Business Metrics: Revenue, conversion, user engagement
- Security: Auth failures, suspicious activity
- Availability: Uptime, health checks
Dashboard Generator (dashboard_generator.py)
Creates comprehensive dashboard specifications with role-based optimization.
Features
- Role-Based Layouts: Optimized for SRE, Developer, Executive, and Ops personas
- Golden Signals Coverage: Automatic inclusion of key monitoring metrics
- Service-Type Specific Panels: Tailored panels based on service characteristics
- Interactive Elements: Template variables, drill-down paths, time range controls
- Grafana Compatibility: Generates Grafana-compatible JSON
Usage Examples
# From service definition
python3 scripts/dashboard_generator.py \
--input assets/sample_service_web.json \
--output dashboard.json
# With specific role optimization
python3 scripts/dashboard_generator.py \
--service-type api \
--name "Payment Service" \
--role developer \
--output payment_dev_dashboard.json
# Generate Grafana-compatible JSON
python3 scripts/dashboard_generator.py \
--input assets/sample_service_api.json \
--output dashboard.json \
--format grafana
# With documentation
python3 scripts/dashboard_generator.py \
--service-type web \
--name "Customer Portal" \
--output portal_dashboard.json \
--doc-output portal_docs.md
Target Roles
- sre: Focus on availability, latency, errors, resource utilization
- developer: Emphasize latency, errors, throughput, business metrics
- executive: Highlight availability, business metrics, user experience
- ops: Priority on resource utilization, capacity, alerts, deployments
Panel Types
- Stat: Single value displays with thresholds
- Gauge: Resource utilization and capacity metrics
- Timeseries: Trend analysis and historical data
- Table: Top N lists and detailed breakdowns
- Heatmap: Distribution and correlation analysis
Sample Data
The assets/ directory contains sample configurations for testing:
sample_service_api.json: Critical API service definitionsample_service_web.json: High-priority web application definitionsample_alerts.json: Alert configuration with optimization opportunities
The expected_outputs/ directory shows example outputs from each script:
sample_slo_framework.json: Complete SLO framework for API serviceoptimized_alerts.json: Optimized alert configurationsample_dashboard.json: SRE dashboard specification
Best Practices
SLO Design
- Start with 1-2 SLOs per service and iterate
- Choose SLIs that directly impact user experience
- Set targets based on user needs, not technical capabilities
- Use error budgets to balance reliability and velocity
Alert Optimization
- Every alert must be actionable
- Alert on symptoms, not causes
- Use multi-window burn rate alerts for SLO protection
- Implement proper escalation and routing policies
Dashboard Design
- Follow the F-pattern for visual hierarchy
- Use consistent color semantics across dashboards
- Include drill-down paths for effective troubleshooting
- Optimize for the target role's specific needs
Integration Patterns
CI/CD Integration
# Generate SLOs during service onboarding
python3 scripts/slo_designer.py --input service-config.json --output slos.json
# Validate alert configurations in pipeline
python3 scripts/alert_optimizer.py --input alerts.json --analyze-only --report validation.html
# Auto-generate dashboards for new services
python3 scripts/dashboard_generator.py --input service-config.json --format grafana --output dashboard.json
Monitoring Stack Integration
- Prometheus: Generated alert rules and recording rules
- Grafana: Dashboard JSON for direct import
- Alertmanager: Routing and escalation policies
- PagerDuty: Escalation configuration
GitOps Workflow
- Store service definitions in version control
- Generate observability configurations in CI/CD
- Deploy configurations via GitOps
- Monitor effectiveness and iterate
Advanced Usage
Custom SLO Targets
Override default targets by including them in service definitions:
{
"name": "special-service",
"type": "api",
"criticality": "high",
"custom_slos": {
"availability_target": 0.9995,
"latency_p95_target_ms": 150,
"error_rate_target": 0.002
}
}
Alert Rule Templates
Use template variables for reusable alert rules:
# Generated Prometheus alert rule
- alert: {{ service_name }}_HighLatency
expr: histogram_quantile(0.95, rate(http_request_duration_seconds_bucket{service="{{ service_name }}"}[5m])) > {{ latency_threshold }}
for: 5m
labels:
severity: warning
service: "{{ service_name }}"
Dashboard Variants
Generate multiple dashboard variants for different use cases:
# SRE operational dashboard
python3 scripts/dashboard_generator.py --input service.json --role sre --output sre-dashboard.json
# Developer debugging dashboard
python3 scripts/dashboard_generator.py --input service.json --role developer --output dev-dashboard.json
# Executive business dashboard
python3 scripts/dashboard_generator.py --input service.json --role executive --output exec-dashboard.json
Troubleshooting
Common Issues
Script Execution Errors
- Ensure Python 3.7+ is installed
- Check file paths and permissions
- Validate JSON syntax in input files
Invalid Service Definitions
- Required fields:
name,type,criticality - Valid service types:
api,web,database,queue,batch,ml - Valid criticality levels:
critical,high,medium,low
Missing Historical Data
- Alert historical data is optional but improves analysis
- Include
fires_per_dayandfalse_positive_ratewhen available - Use monitoring system APIs to populate historical metrics
Debug Mode
Enable verbose logging by setting environment variable:
export DEBUG=1
python3 scripts/slo_designer.py --input service.json
Contributing
Development Setup
# Clone the repository
git clone <repository-url>
cd engineering/observability-designer
# Run tests
python3 -m pytest tests/
# Lint code
python3 -m flake8 scripts/
Adding New Features
- Follow existing code patterns and error handling
- Include comprehensive docstrings and type hints
- Add test cases for new functionality
- Update documentation and examples
Support
For questions, issues, or feature requests:
- Check existing documentation and examples
- Review the reference materials in
references/ - Open an issue with detailed reproduction steps
- Include sample configurations when reporting bugs
This skill is part of the Claude Skills marketplace. For more information about observability best practices, see the reference documentation in the references/ directory.
Skill manifest
Observability Designer (POWERFUL)
Category: Engineering
Tier: POWERFUL
Description: Design comprehensive observability strategies for production systems including SLI/SLO frameworks, alerting optimization, and dashboard generation.
Overview
Observability Designer creates production-ready dashboards, alert configurations, and monitoring strategies across the three pillars (metrics, logs, traces).
When NOT to use → slo-architect. For SLO/SLI design with error-budget math, multi-window burn-rate alerting thresholds, and SLO review gates, route to slo-architect — it is the authoritative skill for that half. This skill's slo_designer.py produces a quick scaffold only. This skill's lane: dashboards (dashboard_generator.py) and alert-noise reduction (alert_optimizer.py).
Quick Start
# Dashboard spec (Grafana JSON + docs) for a service
python3 scripts/dashboard_generator.py --service-type api --name payments --criticality critical --role sre --format grafana -o dashboard.json --doc-output dashboard.md
# Analyze an existing alert config for noise, duplicates, and coverage gaps
python3 scripts/alert_optimizer.py --input alerts.json --analyze-only --report alert_report.json
# ...then emit the optimized config once the report is reviewed:
python3 scripts/alert_optimizer.py --input alerts.json --output alerts_optimized.json
# Quick SLO scaffold (hand off to slo-architect for the real error-budget work)
python3 scripts/slo_designer.py --service-type api --criticality high --user-facing true --service-name payments -o slo_scaffold.json
Verification loop: after deploying optimized alerts, track the report's noise metrics for one on-call rotation — if the actionable-alert ratio didn't improve, re-run --analyze-only against the live config and iterate. Import the generated dashboard into Grafana and confirm every golden-signal panel renders with live data before closing the task.
Core Competencies
SLI/SLO/SLA Framework Design
- Service Level Indicators (SLI): Define measurable signals that indicate service health
- Service Level Objectives (SLO): Set reliability targets based on user experience
- Service Level Agreements (SLA): Establish customer-facing commitments with consequences
- Error Budget Management: Calculate and track error budget consumption
- Burn Rate Alerting: Multi-window burn rate alerts for proactive SLO protection
Three Pillars of Observability
Metrics
- Golden Signals: Latency, traffic, errors, and saturation monitoring
- RED Method: Rate, Errors, and Duration for request-driven services
- USE Method: Utilization, Saturation, and Errors for resource monitoring
- Business Metrics: Revenue, user engagement, and feature adoption tracking
- Infrastructure Metrics: CPU, memory, disk, network, and custom resource metrics
Logs
- Structured Logging: JSON-based log formats with consistent fields
- Log Aggregation: Centralized log collection and indexing strategies
- Log Levels: Appropriate use of DEBUG, INFO, WARN, ERROR, FATAL levels
- Correlation IDs: Request tracing through distributed systems
- Log Sampling: Volume management for high-throughput systems
Traces
- Distributed Tracing: End-to-end request flow visualization
- Span Design: Meaningful span boundaries and metadata
- Trace Sampling: Intelligent sampling strategies for performance and cost
- Service Maps: Automatic dependency discovery through traces
- Root Cause Analysis: Trace-driven debugging workflows
Dashboard Design Principles
Information Architecture
- Hierarchy: Overview → Service → Component → Instance drill-down paths
- Golden Ratio: 80% operational metrics, 20% exploratory metrics
- Cognitive Load: Maximum 7±2 panels per dashboard screen
- User Journey: Role-based dashboard personas (SRE, Developer, Executive)
Visualization Best Practices
- Chart Selection: Time series for trends, heatmaps for distributions, gauges for status
- Color Theory: Red for critical, amber for warning, green for healthy states
- Reference Lines: SLO targets, capacity thresholds, and historical baselines
- Time Ranges: Default to meaningful windows (4h for incidents, 7d for trends)
Panel Design
- Metric Queries: Efficient Prometheus/InfluxDB queries with proper aggregation
- Alerting Integration: Visual alert state indicators on relevant panels
- Interactive Elements: Template variables, drill-down links, and annotation overlays
- Performance: Sub-second render times through query optimization
Alert Design and Optimization
Alert Classification
- Severity Levels:
- Critical: Service down, SLO burn rate high
- Warning: Approaching thresholds, non-user-facing issues
- Info: Deployment notifications, capacity planning alerts
- Actionability: Every alert must have a clear response action
- Alert Routing: Escalation policies based on severity and team ownership
Alert Fatigue Prevention
- Signal vs Noise: High precision (few false positives) over high recall
- Hysteresis: Different thresholds for firing and resolving alerts
- Suppression: Dependent alert suppression during known outages
- Grouping: Related alerts grouped into single notifications
Alert Rule Design
- Threshold Selection: Statistical methods for threshold determination
- Window Functions: Appropriate averaging windows and percentile calculations
- Alert Lifecycle: Clear firing conditions and automatic resolution criteria
- Testing: Alert rule validation against historical data
Runbook Generation and Incident Response
Runbook Structure
- Alert Context: What the alert means and why it fired
- Impact Assessment: User-facing vs internal impact evaluation
- Investigation Steps: Ordered troubleshooting procedures with time estimates
- Resolution Actions: Common fixes and escalation procedures
- Post-Incident: Follow-up tasks and prevention measures
Incident Detection Patterns
- Anomaly Detection: Statistical methods for detecting unusual patterns
- Composite Alerts: Multi-signal alerts for complex failure modes
- Predictive Alerts: Capacity and trend-based forward-looking alerts
- Canary Monitoring: Early detection through progressive deployment monitoring
Golden Signals Framework
Latency Monitoring
- Request Latency: P50, P95, P99 response time tracking
- Queue Latency: Time spent waiting in processing queues
- Network Latency: Inter-service communication delays
- Database Latency: Query execution and connection pool metrics
Traffic Monitoring
- Request Rate: Requests per second with burst detection
- Bandwidth Usage: Network throughput and capacity utilization
- User Sessions: Active user tracking and session duration
- Feature Usage: API endpoint and feature adoption metrics
Error Monitoring
- Error Rate: 4xx and 5xx HTTP response code tracking
- Error Budget: SLO-based error rate targets and consumption
- Error Distribution: Error type classification and trending
- Silent Failures: Detection of processing failures without HTTP errors
Saturation Monitoring
- Resource Utilization: CPU, memory, disk, and network usage
- Queue Depth: Processing queue length and wait times
- Connection Pools: Database and service connection saturation
- Rate Limiting: API throttling and quota exhaustion tracking
Distributed Tracing Strategies
Trace Architecture
- Sampling Strategy: Head-based, tail-based, and adaptive sampling
- Trace Propagation: Context propagation across service boundaries
- Span Correlation: Parent-child relationship modeling
- Trace Storage: Retention policies and storage optimization
Service Instrumentation
- Auto-Instrumentation: Framework-based automatic trace generation
- Manual Instrumentation: Custom span creation for business logic
- Baggage Handling: Cross-cutting concern propagation
- Performance Impact: Instrumentation overhead measurement and optimization
Log Aggregation Patterns
Collection Architecture
- Agent Deployment: Log shipping agent strategies (push vs pull)
- Log Routing: Topic-based routing and filtering
- Parsing Strategies: Structured vs unstructured log handling
- Schema Evolution: Log format versioning and migration
Storage and Indexing
- Index Design: Optimized field indexing for common query patterns
- Retention Policies: Time and volume-based log retention
- Compression: Log data compression and archival strategies
- Search Performance: Query optimization and result caching
Cost Optimization for Observability
Data Management
- Metric Retention: Tiered retention based on metric importance
- Log Sampling: Intelligent sampling to reduce ingestion costs
- Trace Sampling: Cost-effective trace collection strategies
- Data Archival: Cold storage for historical observability data
Resource Optimization
- Query Efficiency: Optimized metric and log queries
- Storage Costs: Appropriate storage tiers for different data types
- Ingestion Rate Limiting: Controlled data ingestion to manage costs
- Cardinality Management: High-cardinality metric detection and mitigation
Scripts Overview
This skill includes three powerful Python scripts for comprehensive observability design:
1. SLO Designer (slo_designer.py)
Generates complete SLI/SLO frameworks based on service characteristics:
- Input: Service description JSON (type, criticality, dependencies)
- Output: SLI definitions, SLO targets, error budgets, burn rate alerts, SLA recommendations
- Features: Multi-window burn rate calculations, error budget policies, alert rule generation
2. Alert Optimizer (alert_optimizer.py)
Analyzes and optimizes existing alert configurations:
- Input: Alert configuration JSON with rules, thresholds, and routing
- Output: Optimization report and improved alert configuration
- Features: Noise detection, coverage gaps, duplicate identification, threshold optimization
3. Dashboard Generator (dashboard_generator.py)
Creates comprehensive dashboard specifications:
- Input: Service/system description JSON
- Output: Grafana-compatible dashboard JSON and documentation
- Features: Golden signals coverage, RED/USE methods, drill-down paths, role-based views
Integration Patterns
Monitoring Stack Integration
- Prometheus: Metric collection and alerting rule generation
- Grafana: Dashboard creation and visualization configuration
- Elasticsearch/Kibana: Log analysis and dashboard integration
- Jaeger/Zipkin: Distributed tracing configuration and analysis
CI/CD Integration
- Pipeline Monitoring: Build, test, and deployment observability
- Deployment Correlation: Release impact tracking and rollback triggers
- Feature Flag Monitoring: A/B test and feature rollout observability
- Performance Regression: Automated performance monitoring in pipelines
Incident Management Integration
- PagerDuty/VictorOps: Alert routing and escalation policies
- Slack/Teams: Notification and collaboration integration
- JIRA/ServiceNow: Incident tracking and resolution workflows
- Post-Mortem: Automated incident analysis and improvement tracking
Advanced Patterns
Multi-Cloud Observability
- Cross-Cloud Metrics: Unified metrics across AWS, GCP, Azure
- Network Observability: Inter-cloud connectivity monitoring
- Cost Attribution: Cloud resource cost tracking and optimization
- Compliance Monitoring: Security and compliance posture tracking
Microservices Observability
- Service Mesh Integration: Istio/Linkerd observability configuration
- API Gateway Monitoring: Request routing and rate limiting observability
- Container Orchestration: Kubernetes cluster and workload monitoring
- Service Discovery: Dynamic service monitoring and health checks
Machine Learning Observability
- Model Performance: Accuracy, drift, and bias monitoring
- Feature Store Monitoring: Feature quality and freshness tracking
- Pipeline Observability: ML pipeline execution and performance monitoring
- A/B Test Analysis: Statistical significance and business impact measurement
Best Practices
Organizational Alignment
- SLO Setting: Collaborative target setting between product and engineering
- Alert Ownership: Clear escalation paths and team responsibilities
- Dashboard Governance: Centralized dashboard management and standards
- Training Programs: Team education on observability tools and practices
Technical Excellence
- Infrastructure as Code: Observability configuration version control
- Testing Strategy: Alert rule testing and dashboard validation
- Performance Monitoring: Observability system performance tracking
- Security Considerations: Access control and data privacy in observability
Continuous Improvement
- Metrics Review: Regular SLI/SLO effectiveness assessment
- Alert Tuning: Ongoing alert threshold and routing optimization
- Dashboard Evolution: User feedback-driven dashboard improvements
- Tool Evaluation: Regular assessment of observability tool effectiveness
More in this skill
Load these only when the task needs them.
- references/alert_design_patterns.md — Alert Design Patterns: A Guide to Effective Alerting
- references/dashboard_best_practices.md — Dashboard Best Practices: Design for Insight and Action
- references/slo_cookbook.md — SLO Cookbook: A Practical Guide to Service Level Objectives
Files (agent-skills)
-
assets
-
sample_alerts.json 8 KB
Loading… -
sample_service_api.json 1.7 KB
Loading… -
sample_service_web.json 2.4 KB
Loading…
-
-
expected_outputs
-
sample_dashboard.json 19.1 KB
Loading… -
sample_slo_framework.json 21.6 KB
Loading…
-
-
references
-
alert_design_patterns.md 11.7 KB
Loading… -
dashboard_best_practices.md 13.8 KB
Loading… -
slo_cookbook.md 10.4 KB
Loading…
-
-
scripts
-
alert_optimizer.py 45.7 KB
Loading… -
dashboard_generator.py 48.4 KB
Loading… -
slo_designer.py 28.8 KB
Loading…
-
-
LICENSE 1 KB · in bundle
-
README.md 11.6 KB
# Observability Designer A comprehensive toolkit for designing production-ready observability strategies including SLI/SLO frameworks, alert optimization, and dashboard generation. ## Overview The Observability Designer skill provides three powerful Python scripts that help you create, optimize, and maintain observability systems: - **SLO Designer**: Generate complete SLI/SLO frameworks with error budgets and burn rate alerts - **Alert Optimizer**: Analyze and optimize existing alert configurations to reduce noise and improve effectiveness - **Dashboard Generator**: Create comprehensive dashboard specifications with role-based layouts and drill-down paths ## Quick Start ### Prerequisites - Python 3.7+ - No external dependencies required (uses Python standard library only) ### Basic Usage ```bash # Generate SLO framework for a service python3 scripts/slo_designer.py --service-type api --criticality critical --user-facing true --service-name payment-service # Optimize existing alerts python3 scripts/alert_optimizer.py --input assets/sample_alerts.json --analyze-only # Generate a dashboard specification python3 scripts/dashboard_generator.py --service-type web --name "Customer Portal" --role sre ``` ## Scripts Documentation ### SLO Designer (`slo_designer.py`) Generates comprehensive SLO frameworks based on service characteristics. #### Features - **Automatic SLI Selection**: Recommends appropriate SLIs based on service type - **Target Setting**: Suggests SLO targets based on service criticality - **Error Budget Calculation**: Computes error budgets and burn rate thresholds - **Multi-Window Burn Rate Alerts**: Generates 4-window burn rate alerting rules - **SLA Recommendations**: Provides customer-facing SLA guidance #### Usage Examples ```bash # From service definition file python3 scripts/slo_designer.py --input assets/sample_service_api.json --output slo_framework.json # From command line parameters python3 scripts/slo_designer.py \ --service-type api \ --criticality critical \ --user-facing true \ --service-name payment-service \ --output payment_slos.json # Generate and display summary only python3 scripts/slo_designer.py --input assets/sample_service_web.json --summary-only ``` #### Service Definition Format ```json { "name": "payment-service", "type": "api", "criticality": "critical", "user_facing": true, "description": "Handles payment processing", "team": "payments", "environment": "production", "dependencies": [ { "name": "user-service", "type": "api", "criticality": "high" } ] } ``` #### Supported Service Types - **api**: REST APIs, GraphQL services - **web**: Web applications, SPAs - **database**: Database services, data stores - **queue**: Message queues, event streams - **batch**: Batch processing jobs - **ml**: Machine learning services #### Criticality Levels - **critical**: 99.99% availability, <100ms P95 latency, <0.1% error rate - **high**: 99.9% availability, <200ms P95 latency, <0.5% error rate - **medium**: 99.5% availability, <500ms P95 latency, <1% error rate - **low**: 99% availability, <1s P95 latency, <2% error rate ### Alert Optimizer (`alert_optimizer.py`) Analyzes existing alert configurations and provides optimization recommendations. #### Features - **Noise Detection**: Identifies alerts with high false positive rates - **Coverage Analysis**: Finds gaps in monitoring coverage - **Duplicate Detection**: Locates redundant or overlapping alerts - **Threshold Analysis**: Reviews alert thresholds for appropriateness - **Fatigue Assessment**: Evaluates alert volume and routing #### Usage Examples ```bash # Analyze existing alerts python3 scripts/alert_optimizer.py --input assets/sample_alerts.json --analyze-only # Generate optimized configuration python3 scripts/alert_optimizer.py \ --input assets/sample_alerts.json \ --output optimized_alerts.json # Generate HTML report python3 scripts/alert_optimizer.py \ --input assets/sample_alerts.json \ --report alert_analysis.html \ --format html ``` #### Alert Configuration Format ```json { "alerts": [ { "alert": "HighLatency", "expr": "histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m])) > 0.5", "for": "5m", "labels": { "severity": "warning", "service": "payment-service" }, "annotations": { "summary": "High request latency detected", "runbook_url": "https://runbooks.company.com/high-latency" }, "historical_data": { "fires_per_day": 2.5, "false_positive_rate": 0.15 } } ], "services": [ { "name": "payment-service", "criticality": "critical" } ] } ``` #### Analysis Categories - **Golden Signals**: Latency, traffic, errors, saturation - **Resource Utilization**: CPU, memory, disk, network - **Business Metrics**: Revenue, conversion, user engagement - **Security**: Auth failures, suspicious activity - **Availability**: Uptime, health checks ### Dashboard Generator (`dashboard_generator.py`) Creates comprehensive dashboard specifications with role-based optimization. #### Features - **Role-Based Layouts**: Optimized for SRE, Developer, Executive, and Ops personas - **Golden Signals Coverage**: Automatic inclusion of key monitoring metrics - **Service-Type Specific Panels**: Tailored panels based on service characteristics - **Interactive Elements**: Template variables, drill-down paths, time range controls - **Grafana Compatibility**: Generates Grafana-compatible JSON #### Usage Examples ```bash # From service definition python3 scripts/dashboard_generator.py \ --input assets/sample_service_web.json \ --output dashboard.json # With specific role optimization python3 scripts/dashboard_generator.py \ --service-type api \ --name "Payment Service" \ --role developer \ --output payment_dev_dashboard.json # Generate Grafana-compatible JSON python3 scripts/dashboard_generator.py \ --input assets/sample_service_api.json \ --output dashboard.json \ --format grafana # With documentation python3 scripts/dashboard_generator.py \ --service-type web \ --name "Customer Portal" \ --output portal_dashboard.json \ --doc-output portal_docs.md ``` #### Target Roles - **sre**: Focus on availability, latency, errors, resource utilization - **developer**: Emphasize latency, errors, throughput, business metrics - **executive**: Highlight availability, business metrics, user experience - **ops**: Priority on resource utilization, capacity, alerts, deployments #### Panel Types - **Stat**: Single value displays with thresholds - **Gauge**: Resource utilization and capacity metrics - **Timeseries**: Trend analysis and historical data - **Table**: Top N lists and detailed breakdowns - **Heatmap**: Distribution and correlation analysis ## Sample Data The `assets/` directory contains sample configurations for testing: - `sample_service_api.json`: Critical API service definition - `sample_service_web.json`: High-priority web application definition - `sample_alerts.json`: Alert configuration with optimization opportunities The `expected_outputs/` directory shows example outputs from each script: - `sample_slo_framework.json`: Complete SLO framework for API service - `optimized_alerts.json`: Optimized alert configuration - `sample_dashboard.json`: SRE dashboard specification ## Best Practices ### SLO Design - Start with 1-2 SLOs per service and iterate - Choose SLIs that directly impact user experience - Set targets based on user needs, not technical capabilities - Use error budgets to balance reliability and velocity ### Alert Optimization - Every alert must be actionable - Alert on symptoms, not causes - Use multi-window burn rate alerts for SLO protection - Implement proper escalation and routing policies ### Dashboard Design - Follow the F-pattern for visual hierarchy - Use consistent color semantics across dashboards - Include drill-down paths for effective troubleshooting - Optimize for the target role's specific needs ## Integration Patterns ### CI/CD Integration ```bash # Generate SLOs during service onboarding python3 scripts/slo_designer.py --input service-config.json --output slos.json # Validate alert configurations in pipeline python3 scripts/alert_optimizer.py --input alerts.json --analyze-only --report validation.html # Auto-generate dashboards for new services python3 scripts/dashboard_generator.py --input service-config.json --format grafana --output dashboard.json ``` ### Monitoring Stack Integration - **Prometheus**: Generated alert rules and recording rules - **Grafana**: Dashboard JSON for direct import - **Alertmanager**: Routing and escalation policies - **PagerDuty**: Escalation configuration ### GitOps Workflow 1. Store service definitions in version control 2. Generate observability configurations in CI/CD 3. Deploy configurations via GitOps 4. Monitor effectiveness and iterate ## Advanced Usage ### Custom SLO Targets Override default targets by including them in service definitions: ```json { "name": "special-service", "type": "api", "criticality": "high", "custom_slos": { "availability_target": 0.9995, "latency_p95_target_ms": 150, "error_rate_target": 0.002 } } ``` ### Alert Rule Templates Use template variables for reusable alert rules: ```yaml # Generated Prometheus alert rule - alert: {{ service_name }}_HighLatency expr: histogram_quantile(0.95, rate(http_request_duration_seconds_bucket{service="{{ service_name }}"}[5m])) > {{ latency_threshold }} for: 5m labels: severity: warning service: "{{ service_name }}" ``` ### Dashboard Variants Generate multiple dashboard variants for different use cases: ```bash # SRE operational dashboard python3 scripts/dashboard_generator.py --input service.json --role sre --output sre-dashboard.json # Developer debugging dashboard python3 scripts/dashboard_generator.py --input service.json --role developer --output dev-dashboard.json # Executive business dashboard python3 scripts/dashboard_generator.py --input service.json --role executive --output exec-dashboard.json ``` ## Troubleshooting ### Common Issues #### Script Execution Errors - Ensure Python 3.7+ is installed - Check file paths and permissions - Validate JSON syntax in input files #### Invalid Service Definitions - Required fields: `name`, `type`, `criticality` - Valid service types: `api`, `web`, `database`, `queue`, `batch`, `ml` - Valid criticality levels: `critical`, `high`, `medium`, `low` #### Missing Historical Data - Alert historical data is optional but improves analysis - Include `fires_per_day` and `false_positive_rate` when available - Use monitoring system APIs to populate historical metrics ### Debug Mode Enable verbose logging by setting environment variable: ```bash export DEBUG=1 python3 scripts/slo_designer.py --input service.json ``` ## Contributing ### Development Setup ```bash # Clone the repository git clone <repository-url> cd engineering/observability-designer # Run tests python3 -m pytest tests/ # Lint code python3 -m flake8 scripts/ ``` ### Adding New Features 1. Follow existing code patterns and error handling 2. Include comprehensive docstrings and type hints 3. Add test cases for new functionality 4. Update documentation and examples ## Support For questions, issues, or feature requests: - Check existing documentation and examples - Review the reference materials in `references/` - Open an issue with detailed reproduction steps - Include sample configurations when reporting bugs --- *This skill is part of the Claude Skills marketplace. For more information about observability best practices, see the reference documentation in the `references/` directory.* -
SKILL.md 13.9 KB
--- name: observability-designer description: "Use when adding metrics, logs and traces to a service, fixing noisy alerts or designing dashboards. Designs SLIs with slo_designer.py, tunes alerts with alert_optimizer.py and generates dashboards with dashboard_generator.py." --- # Observability Designer (POWERFUL) **Category:** Engineering **Tier:** POWERFUL **Description:** Design comprehensive observability strategies for production systems including SLI/SLO frameworks, alerting optimization, and dashboard generation. ## Overview Observability Designer creates production-ready dashboards, alert configurations, and monitoring strategies across the three pillars (metrics, logs, traces). **When NOT to use → slo-architect.** For SLO/SLI design with error-budget math, multi-window burn-rate alerting thresholds, and SLO review gates, route to `slo-architect` — it is the authoritative skill for that half. This skill's `slo_designer.py` produces a quick scaffold only. This skill's lane: dashboards (`dashboard_generator.py`) and alert-noise reduction (`alert_optimizer.py`). ## Quick Start ```bash # Dashboard spec (Grafana JSON + docs) for a service python3 scripts/dashboard_generator.py --service-type api --name payments --criticality critical --role sre --format grafana -o dashboard.json --doc-output dashboard.md # Analyze an existing alert config for noise, duplicates, and coverage gaps python3 scripts/alert_optimizer.py --input alerts.json --analyze-only --report alert_report.json # ...then emit the optimized config once the report is reviewed: python3 scripts/alert_optimizer.py --input alerts.json --output alerts_optimized.json # Quick SLO scaffold (hand off to slo-architect for the real error-budget work) python3 scripts/slo_designer.py --service-type api --criticality high --user-facing true --service-name payments -o slo_scaffold.json ``` **Verification loop:** after deploying optimized alerts, track the report's noise metrics for one on-call rotation — if the actionable-alert ratio didn't improve, re-run `--analyze-only` against the live config and iterate. Import the generated dashboard into Grafana and confirm every golden-signal panel renders with live data before closing the task. ## Core Competencies ### SLI/SLO/SLA Framework Design - **Service Level Indicators (SLI):** Define measurable signals that indicate service health - **Service Level Objectives (SLO):** Set reliability targets based on user experience - **Service Level Agreements (SLA):** Establish customer-facing commitments with consequences - **Error Budget Management:** Calculate and track error budget consumption - **Burn Rate Alerting:** Multi-window burn rate alerts for proactive SLO protection ### Three Pillars of Observability #### Metrics - **Golden Signals:** Latency, traffic, errors, and saturation monitoring - **RED Method:** Rate, Errors, and Duration for request-driven services - **USE Method:** Utilization, Saturation, and Errors for resource monitoring - **Business Metrics:** Revenue, user engagement, and feature adoption tracking - **Infrastructure Metrics:** CPU, memory, disk, network, and custom resource metrics #### Logs - **Structured Logging:** JSON-based log formats with consistent fields - **Log Aggregation:** Centralized log collection and indexing strategies - **Log Levels:** Appropriate use of DEBUG, INFO, WARN, ERROR, FATAL levels - **Correlation IDs:** Request tracing through distributed systems - **Log Sampling:** Volume management for high-throughput systems #### Traces - **Distributed Tracing:** End-to-end request flow visualization - **Span Design:** Meaningful span boundaries and metadata - **Trace Sampling:** Intelligent sampling strategies for performance and cost - **Service Maps:** Automatic dependency discovery through traces - **Root Cause Analysis:** Trace-driven debugging workflows ### Dashboard Design Principles #### Information Architecture - **Hierarchy:** Overview → Service → Component → Instance drill-down paths - **Golden Ratio:** 80% operational metrics, 20% exploratory metrics - **Cognitive Load:** Maximum 7±2 panels per dashboard screen - **User Journey:** Role-based dashboard personas (SRE, Developer, Executive) #### Visualization Best Practices - **Chart Selection:** Time series for trends, heatmaps for distributions, gauges for status - **Color Theory:** Red for critical, amber for warning, green for healthy states - **Reference Lines:** SLO targets, capacity thresholds, and historical baselines - **Time Ranges:** Default to meaningful windows (4h for incidents, 7d for trends) #### Panel Design - **Metric Queries:** Efficient Prometheus/InfluxDB queries with proper aggregation - **Alerting Integration:** Visual alert state indicators on relevant panels - **Interactive Elements:** Template variables, drill-down links, and annotation overlays - **Performance:** Sub-second render times through query optimization ### Alert Design and Optimization #### Alert Classification - **Severity Levels:** - **Critical:** Service down, SLO burn rate high - **Warning:** Approaching thresholds, non-user-facing issues - **Info:** Deployment notifications, capacity planning alerts - **Actionability:** Every alert must have a clear response action - **Alert Routing:** Escalation policies based on severity and team ownership #### Alert Fatigue Prevention - **Signal vs Noise:** High precision (few false positives) over high recall - **Hysteresis:** Different thresholds for firing and resolving alerts - **Suppression:** Dependent alert suppression during known outages - **Grouping:** Related alerts grouped into single notifications #### Alert Rule Design - **Threshold Selection:** Statistical methods for threshold determination - **Window Functions:** Appropriate averaging windows and percentile calculations - **Alert Lifecycle:** Clear firing conditions and automatic resolution criteria - **Testing:** Alert rule validation against historical data ### Runbook Generation and Incident Response #### Runbook Structure - **Alert Context:** What the alert means and why it fired - **Impact Assessment:** User-facing vs internal impact evaluation - **Investigation Steps:** Ordered troubleshooting procedures with time estimates - **Resolution Actions:** Common fixes and escalation procedures - **Post-Incident:** Follow-up tasks and prevention measures #### Incident Detection Patterns - **Anomaly Detection:** Statistical methods for detecting unusual patterns - **Composite Alerts:** Multi-signal alerts for complex failure modes - **Predictive Alerts:** Capacity and trend-based forward-looking alerts - **Canary Monitoring:** Early detection through progressive deployment monitoring ### Golden Signals Framework #### Latency Monitoring - **Request Latency:** P50, P95, P99 response time tracking - **Queue Latency:** Time spent waiting in processing queues - **Network Latency:** Inter-service communication delays - **Database Latency:** Query execution and connection pool metrics #### Traffic Monitoring - **Request Rate:** Requests per second with burst detection - **Bandwidth Usage:** Network throughput and capacity utilization - **User Sessions:** Active user tracking and session duration - **Feature Usage:** API endpoint and feature adoption metrics #### Error Monitoring - **Error Rate:** 4xx and 5xx HTTP response code tracking - **Error Budget:** SLO-based error rate targets and consumption - **Error Distribution:** Error type classification and trending - **Silent Failures:** Detection of processing failures without HTTP errors #### Saturation Monitoring - **Resource Utilization:** CPU, memory, disk, and network usage - **Queue Depth:** Processing queue length and wait times - **Connection Pools:** Database and service connection saturation - **Rate Limiting:** API throttling and quota exhaustion tracking ### Distributed Tracing Strategies #### Trace Architecture - **Sampling Strategy:** Head-based, tail-based, and adaptive sampling - **Trace Propagation:** Context propagation across service boundaries - **Span Correlation:** Parent-child relationship modeling - **Trace Storage:** Retention policies and storage optimization #### Service Instrumentation - **Auto-Instrumentation:** Framework-based automatic trace generation - **Manual Instrumentation:** Custom span creation for business logic - **Baggage Handling:** Cross-cutting concern propagation - **Performance Impact:** Instrumentation overhead measurement and optimization ### Log Aggregation Patterns #### Collection Architecture - **Agent Deployment:** Log shipping agent strategies (push vs pull) - **Log Routing:** Topic-based routing and filtering - **Parsing Strategies:** Structured vs unstructured log handling - **Schema Evolution:** Log format versioning and migration #### Storage and Indexing - **Index Design:** Optimized field indexing for common query patterns - **Retention Policies:** Time and volume-based log retention - **Compression:** Log data compression and archival strategies - **Search Performance:** Query optimization and result caching ### Cost Optimization for Observability #### Data Management - **Metric Retention:** Tiered retention based on metric importance - **Log Sampling:** Intelligent sampling to reduce ingestion costs - **Trace Sampling:** Cost-effective trace collection strategies - **Data Archival:** Cold storage for historical observability data #### Resource Optimization - **Query Efficiency:** Optimized metric and log queries - **Storage Costs:** Appropriate storage tiers for different data types - **Ingestion Rate Limiting:** Controlled data ingestion to manage costs - **Cardinality Management:** High-cardinality metric detection and mitigation ## Scripts Overview This skill includes three powerful Python scripts for comprehensive observability design: ### 1. SLO Designer (`slo_designer.py`) Generates complete SLI/SLO frameworks based on service characteristics: - **Input:** Service description JSON (type, criticality, dependencies) - **Output:** SLI definitions, SLO targets, error budgets, burn rate alerts, SLA recommendations - **Features:** Multi-window burn rate calculations, error budget policies, alert rule generation ### 2. Alert Optimizer (`alert_optimizer.py`) Analyzes and optimizes existing alert configurations: - **Input:** Alert configuration JSON with rules, thresholds, and routing - **Output:** Optimization report and improved alert configuration - **Features:** Noise detection, coverage gaps, duplicate identification, threshold optimization ### 3. Dashboard Generator (`dashboard_generator.py`) Creates comprehensive dashboard specifications: - **Input:** Service/system description JSON - **Output:** Grafana-compatible dashboard JSON and documentation - **Features:** Golden signals coverage, RED/USE methods, drill-down paths, role-based views ## Integration Patterns ### Monitoring Stack Integration - **Prometheus:** Metric collection and alerting rule generation - **Grafana:** Dashboard creation and visualization configuration - **Elasticsearch/Kibana:** Log analysis and dashboard integration - **Jaeger/Zipkin:** Distributed tracing configuration and analysis ### CI/CD Integration - **Pipeline Monitoring:** Build, test, and deployment observability - **Deployment Correlation:** Release impact tracking and rollback triggers - **Feature Flag Monitoring:** A/B test and feature rollout observability - **Performance Regression:** Automated performance monitoring in pipelines ### Incident Management Integration - **PagerDuty/VictorOps:** Alert routing and escalation policies - **Slack/Teams:** Notification and collaboration integration - **JIRA/ServiceNow:** Incident tracking and resolution workflows - **Post-Mortem:** Automated incident analysis and improvement tracking ## Advanced Patterns ### Multi-Cloud Observability - **Cross-Cloud Metrics:** Unified metrics across AWS, GCP, Azure - **Network Observability:** Inter-cloud connectivity monitoring - **Cost Attribution:** Cloud resource cost tracking and optimization - **Compliance Monitoring:** Security and compliance posture tracking ### Microservices Observability - **Service Mesh Integration:** Istio/Linkerd observability configuration - **API Gateway Monitoring:** Request routing and rate limiting observability - **Container Orchestration:** Kubernetes cluster and workload monitoring - **Service Discovery:** Dynamic service monitoring and health checks ### Machine Learning Observability - **Model Performance:** Accuracy, drift, and bias monitoring - **Feature Store Monitoring:** Feature quality and freshness tracking - **Pipeline Observability:** ML pipeline execution and performance monitoring - **A/B Test Analysis:** Statistical significance and business impact measurement ## Best Practices ### Organizational Alignment - **SLO Setting:** Collaborative target setting between product and engineering - **Alert Ownership:** Clear escalation paths and team responsibilities - **Dashboard Governance:** Centralized dashboard management and standards - **Training Programs:** Team education on observability tools and practices ### Technical Excellence - **Infrastructure as Code:** Observability configuration version control - **Testing Strategy:** Alert rule testing and dashboard validation - **Performance Monitoring:** Observability system performance tracking - **Security Considerations:** Access control and data privacy in observability ### Continuous Improvement - **Metrics Review:** Regular SLI/SLO effectiveness assessment - **Alert Tuning:** Ongoing alert threshold and routing optimization - **Dashboard Evolution:** User feedback-driven dashboard improvements - **Tool Evaluation:** Regular assessment of observability tool effectiveness ## More in this skill Load these only when the task needs them. - [references/alert_design_patterns.md](references/alert_design_patterns.md) — Alert Design Patterns: A Guide to Effective Alerting - [references/dashboard_best_practices.md](references/dashboard_best_practices.md) — Dashboard Best Practices: Design for Insight and Action - [references/slo_cookbook.md](references/slo_cookbook.md) — SLO Cookbook: A Practical Guide to Service Level Objectives
Reviews (0)
No reviews yet.
Comments
Sign in to join the conversation.
No comments yet. Start the conversation.