// Canonical example for the book: SLOs attached to systems/containers.

system = kind "System"
container = kind "Container"

R1 = requirement performance "Must maintain 99.9% availability"
R2 = requirement performance "API response time must be under 200ms p95"

api = system "API Service" {
  slo {
    availability {
      target "99.9%"
      window "30 days"
      current "99.95%"
    }
    latency {
      p95 "200ms"
      p99 "500ms"
      window "7 days"
      current {
        p95 "180ms"
        p99 "420ms"
      }
    }
    errorRate {
      target "0.1%"
      window "7 days"
      current "0.08%"
    }
    throughput {
      target "10000 req/s"
      window "1 hour"
      current "8500 req/s"
    }
  }

  webApp = container "Web Application" {
    technology "React"
    description "Web UI for the API service"
    slo {
      availability {
        target "99.9%"
        window "30 days"
      }
      latency {
        p95 "150ms"
        p99 "300ms"
        window "7 days"
      }
    }
  }
}

api -> R1 "meets"
api -> R2 "meets"
api.webApp -> api "part of"

