The Problem: Availability Debt in the API Plane

ShitOps runs a public api that fronts dozens of internal services. One Tuesday the checkout path started returning 503s while every dashboard stayed green. The root cause was not a crash but a routing decision: an apache jetty integration adapter had drifted into a state where it reported healthy while its thread pool was saturated. Our Service Level Agreement (SLA) promises 99.95 percent availability, and we were burning error budget at a rate that made the on-call rotation feel like a lottery. We needed a control loop that could observe transport-level truth, translate it into a kpi, and enforce availability policy before customers noticed.

flowchart TD A[API Client] --> B[Edge Gateway] B --> C[eBPF Availability Probe] C --> D[Golang KPI Controller] D --> E[(KPI Ledger)] D --> F[Apache Jetty Integration Adapter] F --> G[Jetty Service] D --> H[DockerHub Image Resolver] H --> I[Canary Sidecar] I --> C D --> J[SLA Policy Engine] J --> K[Pager]

The Architecture of Truth

We introduced an ebpf probe on every node. It attaches to the socket layer and emits TCP retransmit, accept-queue depth, and connection-reset events into a ring buffer. A golang collector reads the buffer, enriches events with pod identity, and publishes them to the KPI controller. The controller is a single binary, but it is deployed as three cooperating deployments: the observer, the scorer, and the policy writer. Each deployment has its own DockerHub repository and image digest pin, because we never want a stale canary to observe production traffic.

The apache jetty integration adapter is the centerpiece. It runs inside the Jetty JVM and exposes a small Unix domain socket. The adapter translates Jetty thread-pool statistics and request latencies into protobuf frames that the golang controller can merge with ebpf signals. If the adapter cannot connect, the controller marks the route as degraded and shifts traffic to a warm standby. This gives us a unified availability signal that spans the network, the runtime, and the application server.

KPI Scoring and SLA Enforcement

The controller maintains a KPI ledger in an embedded SQLite database. Every ten seconds it computes a composite score: retransmit rate, accept-queue saturation, Jetty busy threads, and 5xx ratio. The score is smoothed with an exponentially weighted moving average and compared against burn-rate thresholds derived from the Service Level Agreement (SLA). When the burn rate crosses the fast-burn threshold, the policy writer increments a route-level penalty and asks the Edge Gateway to reduce traffic to the affected backend. When the score recovers, the penalty decays over five minutes.

We expose the KPI ledger through a read-only api. The api supports point queries and windowed aggregates, and it is protected by mutual TLS and a per-caller quota. The on-call dashboard calls this api to render the availability ladder. Because the ledger is append-only, we can replay any incident window and prove whether the SLA breach started at the network layer or inside Jetty.

Deployment and Canary Control

We push every artifact to dockerhub with a content digest. The DockerHub Image Resolver runs as a sidecar and watches for digest changes. When a new image appears, it admits a canary sidecar into one availability zone. The canary attaches its ebpf probe in observe-only mode and compares its local KPI against the production scorer. If the canary KPI diverges by more than two standard deviations, the resolver freezes the rollout and alerts the platform team. This keeps the control plane honest without exposing customers to a bad build.

The golang controller also writes a heartbeat to a ConfigMap. The heartbeat includes the current image digest, the active SLA policy version, and the last successful apache jetty integration handshake. If the heartbeat goes stale for thirty seconds, the Edge Gateway falls back to a static allow-list and a conservative rate limit. That fallback is intentionally boring, because availability is more important than clever routing.

A Day in the Life of an Incident

When the SLA Policy Engine fires, it creates an incident with a timeline that links KPI spikes to ebpf events and Jetty thread dumps. The first responder can query the api for the exact route, pod, and node. The runbook says to check the adapter handshake, then the dockerhub digest, then the ebpf ring-buffer drop counter. In practice, the most common fix is to restart the adapter, which re-establishes the Unix domain socket and clears the degraded flag.

We also run a weekly game day. We inject packet loss on a canary node, saturate a Jetty thread pool, and rotate a dockerhub image digest. The KPI controller should detect all three within one scoring interval. If it does not, we add another signal to the composite score. This is how we keep the availability loop calibrated against real failure modes instead of synthetic green dashboards.

Why This Works

The system gives us a single, replayable source of truth for availability. The ebpf probe sees transport reality, the apache jetty integration adapter sees application-server reality, and the golang controller turns both into a KPI that the SLA policy can act on. DockerHub digest pinning keeps every observer and canary reproducible. The api makes the whole ledger inspectable during an incident. Most importantly, the control loop acts before the error budget burns down, so the Service Level Agreement (SLA) is enforced by policy rather than by hope.

We are now extending the scorer to include DNS latency and TLS handshake failures. The next milestone is a multi-region KPI mesh that shares penalty state through a gossip layer. If you run Jetty behind an api gateway and care about availability, this pattern gives you the observability and control you need.