|
| 1 | +# Service Level Objectives (SLO) |
| 2 | + |
| 3 | +**Last Updated**: July 29, 2026 |
| 4 | +**Version**: 1.0.0 |
| 5 | +**Applies To**: Sanctifier Hosted API & Dashboard (mainnet-stable) |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +This document defines Service Level Objectives (SLOs) for the Sanctifier hosted scanning service. These targets guide operational decisions, capacity planning, and incident response priorities. |
| 10 | + |
| 11 | +**Target Audience**: Users, operators, and maintainers of the Sanctifier hosted service. |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## What Are SLOs? |
| 16 | + |
| 17 | +**Service Level Objectives (SLOs)** are internal targets that define the expected reliability and performance of a service. They are: |
| 18 | + |
| 19 | +- **Measurable** - Based on quantitative metrics |
| 20 | +- **Achievable** - Realistic given current infrastructure |
| 21 | +- **User-Centric** - Reflect what users care about (latency, availability, throughput) |
| 22 | + |
| 23 | +**Service Level Agreements (SLAs)** are contractual commitments with consequences for non-compliance. This document defines SLOs only. Legal SLA terms for paid tiers are covered separately in the Terms of Service. |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +## Core SLO Targets |
| 28 | + |
| 29 | +### 1. API Availability |
| 30 | + |
| 31 | +**Definition**: Percentage of time the API endpoint (`/api/v1/analyze`) returns successful responses (HTTP 2xx or 4xx, excluding 5xx errors). |
| 32 | + |
| 33 | +| Metric | Target | Measurement Window | Measurement Method | |
| 34 | +|--------|--------|-------------------|-------------------| |
| 35 | +| **Uptime** | ≥ 99.5% | Monthly (30 days) | Prometheus `up{job="api"}` | |
| 36 | +| **Success Rate** | ≥ 99.0% | Monthly | `(2xx + 4xx) / total_requests` | |
| 37 | + |
| 38 | +**What Counts as Downtime**: |
| 39 | +- ✅ HTTP 500, 502, 503, 504 (server errors) |
| 40 | +- ✅ Connection timeouts or refused connections |
| 41 | +- ✅ DNS resolution failures |
| 42 | + |
| 43 | +**What Does NOT Count as Downtime**: |
| 44 | +- ❌ HTTP 400, 401, 403, 413, 422, 429 (client errors) |
| 45 | +- ❌ Planned maintenance windows (announced ≥24h in advance) |
| 46 | +- ❌ Upstream provider outages (Stellar RPC, GitHub, etc.) |
| 47 | + |
| 48 | +**Target**: **99.5% uptime** = max **3.6 hours downtime per month** |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +### 2. Scan Latency |
| 53 | + |
| 54 | +**Definition**: Time from receiving an analysis request to returning the complete result (p50, p95, p99 percentiles). |
| 55 | + |
| 56 | +| Percentile | Free Tier Target | Pro Tier Target | Enterprise Target | Measurement Window | |
| 57 | +|------------|------------------|-----------------|-------------------|-------------------| |
| 58 | +| **p50** (median) | ≤ 5 seconds | ≤ 3 seconds | ≤ 2 seconds | 5 minutes | |
| 59 | +| **p95** | ≤ 12 seconds | ≤ 8 seconds | ≤ 5 seconds | 5 minutes | |
| 60 | +| **p99** | ≤ 25 seconds | ≤ 15 seconds | ≤ 10 seconds | 5 minutes | |
| 61 | + |
| 62 | +**Measurement Method**: |
| 63 | +- Start: Request received by API gateway |
| 64 | +- End: Complete JSON/SARIF response sent to client |
| 65 | +- Metric: Prometheus histogram `http_request_duration_seconds{endpoint="/api/v1/analyze"}` |
| 66 | + |
| 67 | +**Exclusions**: |
| 68 | +- Requests that hit rate limits (HTTP 429) - not measured |
| 69 | +- Requests exceeding file size limits (HTTP 413) - not measured |
| 70 | +- Timeouts due to malformed contracts (HTTP 422) - measured separately |
| 71 | + |
| 72 | +**Notes**: |
| 73 | +- Large contracts (>500 KB) may exceed p99 targets |
| 74 | +- Complex analysis rules (e.g., symbolic execution) may increase latency |
| 75 | +- Cold-start latency (first request after idle period) measured separately |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +### 3. Queue Wait Time |
| 80 | + |
| 81 | +**Definition**: Time a request spends waiting in the job queue before analysis begins (when concurrent limit is reached). |
| 82 | + |
| 83 | +| Tier | Max Wait Time | Measurement Method | |
| 84 | +|------|---------------|-------------------| |
| 85 | +| **Free** | ≤ 30 seconds | `queue_wait_seconds{tier="free"}` p95 | |
| 86 | +| **Pro** | ≤ 10 seconds | `queue_wait_seconds{tier="pro"}` p95 | |
| 87 | +| **Enterprise** | ≤ 2 seconds | `queue_wait_seconds{tier="enterprise"}` p95 | |
| 88 | + |
| 89 | +**Target**: **p95 queue wait time** within tier-specific limits |
| 90 | + |
| 91 | +**What Happens When Exceeded**: |
| 92 | +- Requests waiting >60 seconds are auto-rejected with HTTP 503 |
| 93 | +- `retry-after` header suggests when to retry |
| 94 | +- Users receive a "Service Busy" error |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +### 4. Dashboard Page Load Time |
| 99 | + |
| 100 | +**Definition**: Time for the Sanctifier web dashboard to become interactive (Largest Contentful Paint - LCP). |
| 101 | + |
| 102 | +| Page | Target (p75) | Measurement Method | |
| 103 | +|------|-------------|-------------------| |
| 104 | +| **Homepage** | ≤ 2.5 seconds | Vercel Analytics LCP | |
| 105 | +| **Scan Results** | ≤ 3.0 seconds | Vercel Analytics LCP | |
| 106 | +| **Contract Upload** | ≤ 2.0 seconds | Vercel Analytics LCP | |
| 107 | + |
| 108 | +**Measurement Window**: Rolling 7 days |
| 109 | +**Measurement Tool**: Vercel Web Vitals / Lighthouse CI |
| 110 | + |
| 111 | +**Target**: **p75 LCP ≤ 2.5 seconds** across all pages |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +### 5. Error Budget |
| 116 | + |
| 117 | +**Definition**: Allowed failure rate before triggering incident response. |
| 118 | + |
| 119 | +| Service Component | Monthly Error Budget | Trigger Action | |
| 120 | +|-------------------|---------------------|----------------| |
| 121 | +| **API** | 0.5% (99.5% success rate) | Page on-call engineer if exceeded | |
| 122 | +| **Dashboard** | 1.0% (99.0% page load success) | Alert Slack #alerts channel | |
| 123 | +| **CLI Auto-Update** | 2.0% (98.0% download success) | Log for post-mortem review | |
| 124 | + |
| 125 | +**Error Budget Calculation**: |
| 126 | +``` |
| 127 | +Error Budget = (1 - SLO) × Total Requests |
| 128 | +Example: 99.5% SLO over 1M requests = 5,000 allowed errors |
| 129 | +``` |
| 130 | + |
| 131 | +**When Error Budget is Exhausted**: |
| 132 | +1. Stop non-critical releases and feature work |
| 133 | +2. Focus on reliability improvements |
| 134 | +3. Conduct post-mortem to identify root cause |
| 135 | +4. Implement preventive measures |
| 136 | + |
| 137 | +--- |
| 138 | + |
| 139 | +## Measurement & Monitoring |
| 140 | + |
| 141 | +### Data Sources |
| 142 | + |
| 143 | +| Metric | Tool | Dashboard | Alert Channel | |
| 144 | +|--------|------|-----------|---------------| |
| 145 | +| **API Uptime** | Prometheus + Grafana | [API Health Dashboard](#) | #alerts (Slack) | |
| 146 | +| **Scan Latency** | Prometheus histograms | [Latency Dashboard](#) | #performance | |
| 147 | +| **Queue Depth** | Redis metrics | [Queue Monitor](#) | #capacity | |
| 148 | +| **Dashboard Performance** | Vercel Analytics | [Web Vitals](#) | #frontend | |
| 149 | +| **Error Rate** | Sentry + Prometheus | [Error Budget](#) | #incidents | |
| 150 | + |
| 151 | +### Alerting Thresholds |
| 152 | + |
| 153 | +| Condition | Severity | Response Time | Escalation | |
| 154 | +|-----------|----------|---------------|------------| |
| 155 | +| API uptime <99.5% over 1 hour | **Critical** | Immediate page | On-call engineer | |
| 156 | +| p95 latency >15s for 5 minutes | **High** | 15 minutes | #alerts channel | |
| 157 | +| Queue wait p95 >60s for 10 min | **Medium** | 30 minutes | Capacity planning team | |
| 158 | +| Error budget 50% consumed | **Low** | Next business day | Weekly review | |
| 159 | + |
| 160 | +--- |
| 161 | + |
| 162 | +## SLO Violation Response |
| 163 | + |
| 164 | +### Incident Severity Classification |
| 165 | + |
| 166 | +| Severity | Definition | Example | Target Response | |
| 167 | +|----------|-----------|---------|-----------------| |
| 168 | +| **SEV-1 (Critical)** | Complete service outage | API returns 503 for all requests | <15 minutes | |
| 169 | +| **SEV-2 (High)** | Partial outage or severe degradation | p95 latency >3x SLO | <1 hour | |
| 170 | +| **SEV-3 (Medium)** | Minor degradation, still functional | p95 latency 1.5-3x SLO | <4 hours | |
| 171 | +| **SEV-4 (Low)** | No user impact, monitoring alert | Error budget 75% consumed | Next business day | |
| 172 | + |
| 173 | +### Incident Response Workflow |
| 174 | + |
| 175 | +1. **Detection**: Automated alert fires in #alerts |
| 176 | +2. **Acknowledgment**: On-call engineer acknowledges within SLA |
| 177 | +3. **Investigation**: Identify root cause using logs/metrics |
| 178 | +4. **Mitigation**: Implement fix or rollback |
| 179 | +5. **Communication**: Update status page with user-facing message |
| 180 | +6. **Resolution**: Confirm SLO metrics return to normal |
| 181 | +7. **Post-Mortem**: Document incident, root cause, and preventive actions (within 48 hours) |
| 182 | + |
| 183 | +--- |
| 184 | + |
| 185 | +## SLO Review & Updates |
| 186 | + |
| 187 | +### Review Cadence |
| 188 | + |
| 189 | +- **Monthly**: Review SLO performance against targets |
| 190 | +- **Quarterly**: Assess if SLOs need adjustment based on: |
| 191 | + - Actual performance data |
| 192 | + - User feedback and complaints |
| 193 | + - Infrastructure changes |
| 194 | + - Cost vs. reliability tradeoffs |
| 195 | + |
| 196 | +### Revision Process |
| 197 | + |
| 198 | +1. Propose SLO change with justification (GitHub issue) |
| 199 | +2. Review with engineering and product teams |
| 200 | +3. Communicate changes to users ≥30 days before effective date |
| 201 | +4. Update this document with new version number |
| 202 | + |
| 203 | +**Version History**: |
| 204 | +- **v1.0.0** (2026-07-29): Initial SLO targets for mainnet-stable |
| 205 | + |
| 206 | +--- |
| 207 | + |
| 208 | +## Out of Scope |
| 209 | + |
| 210 | +This SLO document does **NOT** cover: |
| 211 | + |
| 212 | +- ❌ **Legal SLA terms** - See Terms of Service for contractual commitments |
| 213 | +- ❌ **CLI local analysis** - Performance depends on user's hardware |
| 214 | +- ❌ **VS Code extension** - Responsiveness depends on VS Code host |
| 215 | +- ❌ **Third-party integrations** - GitHub Actions, Discord bots (separate SLOs if needed) |
| 216 | +- ❌ **Mainnet contract deployment** - Stellar network uptime outside our control |
| 217 | + |
| 218 | +--- |
| 219 | + |
| 220 | +## Baseline Data & Assumptions |
| 221 | + |
| 222 | +**Note**: This initial SLO document is based on **conservative estimates** and industry benchmarks, as baseline metrics from production monitoring (#1150) are not yet available. |
| 223 | + |
| 224 | +### Assumptions |
| 225 | + |
| 226 | +- **Traffic estimate**: 10,000 API requests/day at mainnet launch |
| 227 | +- **Average request size**: 150 KB |
| 228 | +- **Analysis workload**: 80% simple contracts (<5s), 15% medium (5-15s), 5% complex (15-30s) |
| 229 | +- **Infrastructure**: Vercel serverless + Redis queue + PostgreSQL |
| 230 | +- **Geographic distribution**: 70% US, 20% Europe, 10% Asia-Pacific |
| 231 | + |
| 232 | +### Expected Adjustments |
| 233 | + |
| 234 | +Once Grafana/Prometheus dashboards (#1150) provide actual performance data, we will: |
| 235 | + |
| 236 | +1. **Tighten or relax targets** based on observed p95/p99 latency |
| 237 | +2. **Add tier-specific SLOs** for Free vs. Pro if variance is significant |
| 238 | +3. **Set queue depth alerts** based on actual concurrency patterns |
| 239 | +4. **Refine error budgets** based on real failure modes |
| 240 | + |
| 241 | +**Target Date for First Revision**: 30 days after mainnet launch (August 29, 2026) |
| 242 | + |
| 243 | +--- |
| 244 | + |
| 245 | +## Reporting & Transparency |
| 246 | + |
| 247 | +### Public Status Page |
| 248 | + |
| 249 | +Real-time service status available at: **[status.sanctifier.hypersafeD.io](#)** (see #1147) |
| 250 | + |
| 251 | +Displays: |
| 252 | +- ✅ Current operational status (Operational / Degraded / Outage) |
| 253 | +- 📊 90-day uptime history |
| 254 | +- 🔔 Active and resolved incidents |
| 255 | +- 📅 Scheduled maintenance windows |
| 256 | + |
| 257 | +### Historical Performance Reports |
| 258 | + |
| 259 | +Monthly SLO performance reports published at: **[sanctifier.hypersafeD.io/status/reports](#)** |
| 260 | + |
| 261 | +Includes: |
| 262 | +- Achieved uptime % vs. 99.5% target |
| 263 | +- Latency percentiles (p50/p95/p99) vs. targets |
| 264 | +- Error budget consumption |
| 265 | +- Incident summaries and post-mortems |
| 266 | + |
| 267 | +--- |
| 268 | + |
| 269 | +## Contact & Support |
| 270 | + |
| 271 | +### For Users |
| 272 | + |
| 273 | +- **Status Page**: [status.sanctifier.hypersafeD.io](#) |
| 274 | +- **Support Email**: [support@hypersafeD.io](mailto:support@hypersafeD.io) |
| 275 | +- **GitHub Issues**: [HyperSafeD/Sanctifier/issues](https://github.com/HyperSafeD/Sanctifier/issues) |
| 276 | + |
| 277 | +### For Operators |
| 278 | + |
| 279 | +- **On-Call Rotation**: PagerDuty schedule |
| 280 | +- **Runbooks**: [docs/runbooks/](./runbooks/) |
| 281 | +- **Incident Channel**: #incidents (Slack) |
| 282 | + |
| 283 | +--- |
| 284 | + |
| 285 | +## Related Documentation |
| 286 | + |
| 287 | +- [API Pricing & Limits](./api-pricing-limits.md) - Rate limits and tier quotas |
| 288 | +- [Architecture Overview](../ARCHITECTURE.md) - System design and dependencies |
| 289 | +- [Monitoring Setup](#) - Prometheus/Grafana configuration (#1150) |
| 290 | +- [Incident Response Playbook](#) - Detailed incident handling procedures |
| 291 | +- [Status Page](#) - Public-facing service status (#1147) |
| 292 | + |
| 293 | +--- |
| 294 | + |
| 295 | +## Glossary |
| 296 | + |
| 297 | +| Term | Definition | |
| 298 | +|------|------------| |
| 299 | +| **SLO** | Service Level Objective - Internal reliability target | |
| 300 | +| **SLA** | Service Level Agreement - Contractual commitment with penalties | |
| 301 | +| **SLI** | Service Level Indicator - Measurable metric (latency, error rate) | |
| 302 | +| **Error Budget** | Allowed failure rate before triggering corrective action | |
| 303 | +| **p50/p95/p99** | Percentile latency (50th, 95th, 99th percentile of requests) | |
| 304 | +| **LCP** | Largest Contentful Paint - Web performance metric | |
| 305 | +| **Uptime** | Percentage of time service is available and functional | |
| 306 | + |
| 307 | +--- |
| 308 | + |
| 309 | +**Document Owner**: Platform Team |
| 310 | +**Last Review**: 2026-07-29 |
| 311 | +**Next Review**: 2026-08-29 (30 days post-mainnet launch) |
| 312 | + |
| 313 | +--- |
| 314 | + |
| 315 | +## Appendix: SLO Calculation Examples |
| 316 | + |
| 317 | +### Example 1: Monthly Uptime |
| 318 | + |
| 319 | +``` |
| 320 | +Target: 99.5% uptime per month |
| 321 | +Month: 30 days = 43,200 minutes |
| 322 | +
|
| 323 | +Allowed downtime = (1 - 0.995) × 43,200 = 216 minutes = 3.6 hours |
| 324 | +
|
| 325 | +If actual downtime = 180 minutes (3 hours): |
| 326 | + Achieved uptime = (43,200 - 180) / 43,200 = 99.58% ✅ PASS |
| 327 | +``` |
| 328 | + |
| 329 | +### Example 2: Error Budget |
| 330 | + |
| 331 | +``` |
| 332 | +Target: 99.0% success rate |
| 333 | +Monthly requests: 1,000,000 |
| 334 | +
|
| 335 | +Error budget = 1,000,000 × (1 - 0.990) = 10,000 allowed errors |
| 336 | +
|
| 337 | +Week 1: 2,000 errors (20% budget consumed) |
| 338 | +Week 2: 3,500 errors (35% consumed, 55% total) |
| 339 | +Week 3: 5,000 errors (50% consumed, 105% total) ❌ EXCEEDED |
| 340 | +
|
| 341 | +Action: Halt feature releases, focus on reliability |
| 342 | +``` |
| 343 | + |
| 344 | +### Example 3: Latency SLO Compliance |
| 345 | + |
| 346 | +``` |
| 347 | +Target: p95 latency ≤ 12 seconds (Free tier) |
| 348 | +Sample: 1,000 requests over 5 minutes |
| 349 | +
|
| 350 | +Latencies sorted: |
| 351 | + p50 = 4.2 seconds ✅ |
| 352 | + p95 = 11.8 seconds ✅ |
| 353 | + p99 = 24.3 seconds (no p99 SLO for Free tier) |
| 354 | +
|
| 355 | +Result: PASS (p95 within target) |
| 356 | +``` |
| 357 | + |
| 358 | +--- |
| 359 | + |
| 360 | +*This document is a living document and will be updated as the service evolves and more data becomes available.* |
0 commit comments