Skip to content

feat(enclave): serve metrics over vsock for the parent to forward - #29

Merged
Marketen merged 1 commit into
mainfrom
feat/enclave-metrics
Nov 25, 2026
Merged

Marketen merged 1 commit into
mainfrom
feat/enclave-metrics

Conversation

@Marketen

Copy link
Copy Markdown
Contributor

Why

The enclave gateway records the same Prometheus metrics as the regular gateway, but in Nitro builds they bind to 127.0.0.1 inside the enclave, where nothing can reach them. So we have no latency, error or traffic numbers for the TEE.

What changes

  • Nitro builds serve /metrics on vsock port 9090 (profile.MetricsVsockPort). The parent host forwards it to Prometheus (companion infrastructure PR).
  • Ordinary builds are unchanged: they still listen on METRICS_PORT.

The parent connects in to the enclave, so the enclave gains no new way out, and the egress allowlist is unchanged. Metrics carry model, provider and error labels, never request content. The manifest schema stays at 4.

Metric names are identical to the regular gateway's, so the existing Grafana dashboard (job="nexus-gateway") shows both gateways summed once Prometheus scrapes this one; split by instance (premium-1 / nexus-tee-1) to compare them.

Checked

go build ./..., go vet for both the ordinary and the Nitro build, and go test ./... pass.

Not checked: the vsock listener itself, which needs a real Nitro host. It uses the same vsock.Listen call as the gateway's ingress.

Deploying

Release, then cut the enclave over as usual. Merge the infrastructure PR's scrape target after this is running, or Prometheus shows nexus-tee-1 as down until then.

🤖 Generated with Claude Code

The enclave gateway records the same Prometheus metrics as the regular one,
but binds them to 127.0.0.1 inside the enclave, where nothing can reach them.

Serve /metrics on vsock port 9090 in Nitro builds. The parent forwards that
port to its WireGuard address, so Prometheus scrapes both gateways under one
job. The parent connects in; the enclave gains no new way out. Ordinary
builds still listen on METRICS_PORT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Marketen
Marketen marked this pull request as ready for review November 25, 2026 09:44
@Marketen
Marketen merged commit 90b2323 into main Nov 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant