# SLA Report

# SLA Report

> **Project:** Bilko
> **Version:** 0.1
> **Date:** 2026-02-23
> **Author:** Ops Architect
> **Status:** Draft (Template — fill in monthly)
> **Reviewers:** Tech Lead, Alem Bašić

## Document History
| Version | Date | Author | Changes |
|---------|------|--------|---------|
| 0.1     | 2026-02-23 | Ops Architect | Initial draft |

---

## INSTRUCTIONS

Generate monthly SLA reports by the 5th business day of the following month.
File location: `docs/operations/sla-reports/SLA-YYYY-MM.md`

---

# SLA Report: [Month YYYY]

**Reporting Period:** YYYY-MM-01 to YYYY-MM-[last day]
**Report Date:** YYYY-MM-DD
**Prepared by:** Ops Architect

---

## 1. SLA Summary

### Service Level Objectives (SLOs)

| SLO | Target | Actual | Status |
|-----|--------|--------|--------|
| API availability | ≥ 99.5% / month | X.XX% | ✅ / ❌ |
| API P95 response time | < 500ms | XXXms | ✅ / ❌ |
| API error rate (5xx) | < 0.5% | X.XX% | ✅ / ❌ |
| Frontend availability | ≥ 99.9% / month | X.XX% | ✅ / ❌ |
| Uptime (combined) | ≥ 99.5% / month | X.XX% | ✅ / ❌ |

### SLO Calculation

```
API Availability = (Total minutes in month - Downtime minutes) / Total minutes × 100

Total minutes in month (28 days) = 40,320
Total minutes in month (31 days) = 44,640

Allowed downtime at 99.5%:
- 28-day month: 201.6 minutes = ~3h 22min
- 31-day month: 223.2 minutes = ~3h 43min
```

---

## 2. Uptime Metrics

### API (api.bilko.io)

| Metric | Value |
|--------|-------|
| Measured uptime | X.XX% |
| Total downtime | X minutes |
| Number of incidents | X |
| Longest outage | X minutes |

### Frontend (bilko.io)

| Metric | Value |
|--------|-------|
| Measured uptime | X.XX% |
| Total downtime | X minutes |
| Number of incidents | X |

**Source:** BetterStack uptime monitoring (1-min check interval)

---

## 3. Performance Metrics

### API Response Times

| Metric | Target | Week 1 | Week 2 | Week 3 | Week 4 | Month Avg |
|--------|--------|--------|--------|--------|--------|-----------|
| P50 | < 100ms | | | | | |
| P95 | < 500ms | | | | | |
| P99 | < 1000ms | | | | | |

### Critical Endpoint Performance

| Endpoint | P95 Target | P95 Actual | Status |
|----------|-----------|------------|--------|
| POST /api/v1/invoices | < 500ms | XXXms | ✅ / ❌ |
| GET /api/v1/invoices | < 200ms | XXXms | ✅ / ❌ |
| GET /api/v1/reports/vat | < 3000ms | XXXms | ✅ / ❌ |
| POST /api/v1/auth/login | < 300ms | XXXms | ✅ / ❌ |

**Source:** Railway metrics + Sentry performance monitoring

---

## 4. Error Metrics

### Error Rate by Week

| Week | Total Requests | 5xx Errors | Error Rate | Status |
|------|---------------|-----------|------------|--------|
| Week 1 | | | X.XX% | |
| Week 2 | | | X.XX% | |
| Week 3 | | | X.XX% | |
| Week 4 | | | X.XX% | |
| **Month** | | | **X.XX%** | |

### Top Errors (Sentry)

| # | Error | Count | Affected Users | Status |
|---|-------|-------|----------------|--------|
| 1 | [Error message] | X | X | Fixed / Investigating |
| 2 | | | | |
| 3 | | | | |

---

## 5. Incidents This Month

| Incident ID | Date | Duration | Severity | Root Cause | Resolved |
|------------|------|----------|----------|-----------|---------|
| INC-YYYY-MM-DD-001 | YYYY-MM-DD | X min | P0/P1/P2 | [Short description] | Yes |

**Total downtime from incidents:** X minutes
**P0 incidents:** X (target: 0)
**P1 incidents:** X (target: < 2/month)

---

## 6. Financial Data Integrity (Monthly Verification)

**Required:** Verify no financial data corruption occurred this month.

| Check | Method | Result |
|-------|--------|--------|
| Double-entry balance | SQL: SUM(debits) = SUM(credits) per org | ✅ Balanced / ❌ Issues found |
| Invoice total accuracy | SQL: total = subtotal + tax - discount | ✅ Accurate / ❌ Issues found |
| VAT calculation accuracy | Spot-check 10 random invoices | ✅ Accurate / ❌ Issues found |
| No orphaned transactions | SQL: all transactions have debit+credit | ✅ Clean / ❌ Issues found |

**Verification queries run on:** YYYY-MM-DD
**Verified by:** [Name]

```sql
-- Monthly double-entry balance verification
SELECT
  o.name as organization_name,
  SUM(CASE WHEN te.type = 'debit' THEN te.amount ELSE 0 END) as total_debits,
  SUM(CASE WHEN te.type = 'credit' THEN te.amount ELSE 0 END) as total_credits,
  ABS(SUM(CASE WHEN te.type = 'debit' THEN te.amount ELSE -te.amount END)) as imbalance
FROM transaction_entries te
JOIN transactions t ON t.id = te."transactionId"
JOIN organizations o ON o.id = t."organizationId"
WHERE t.created_at >= DATE_TRUNC('month', CURRENT_DATE)
  AND t.created_at < DATE_TRUNC('month', CURRENT_DATE) + INTERVAL '1 month'
GROUP BY o.id, o.name
HAVING ABS(SUM(CASE WHEN te.type = 'debit' THEN te.amount ELSE -te.amount END)) > 0.0001
ORDER BY imbalance DESC;
-- Expected: 0 rows (all organizations balanced)
```

---

## 7. Infrastructure Metrics

### Railway (Backend + Database)

| Resource | Average | Peak | Trend |
|----------|---------|------|-------|
| API CPU | X% | X% | Stable / Growing / Decreasing |
| API Memory | XMB | XMB | Stable / Growing / Decreasing |
| DB Connections | X avg | X peak | Stable / Growing |
| DB Storage | XGB | — | +X GB this month |

### Vercel (Frontend)

| Metric | Value |
|--------|-------|
| Total page views | X |
| Unique visitors | X |
| Average LCP | Xms |
| Average CLS | X |

---

## 8. Cost Report

| Service | Budget | Actual | Variance |
|---------|--------|--------|---------|
| Railway (API + DB) | €20 | €XX | +/-€XX |
| Vercel | €0 | €XX | +/-€XX |
| Cloudflare R2 | €1 | €XX | +/-€XX |
| SendGrid | €0 | €XX | +/-€XX |
| **Total** | **€21** | **€XX** | **+/-€XX** |

---

## 9. SLA Trending

| Month | API Uptime | P95 Latency | Error Rate | Incidents |
|-------|-----------|-------------|------------|-----------|
| [Previous -2] | — | — | — | — |
| [Previous -1] | — | — | — | — |
| [This month] | X.XX% | XXXms | X.XX% | X |

---

## 10. Action Items from This Report

| # | Issue | Action | Owner | Due |
|---|-------|--------|-------|-----|
| 1 | [Issue] | [Action] | [Owner] | YYYY-MM-DD |

---

## Approval
| Role | Name | Date | Signature |
|------|------|------|-----------|
| Author | Ops Architect | | |
| Reviewer | Alem Bašić | | |