Repository navigation
feat(enclave): serve metrics over vsock for the parent to forward - #29
Merged
Merged
Conversation
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
marked this pull request as ready for review
November 25, 2026 09:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The enclave gateway records the same Prometheus metrics as the regular gateway, but in Nitro builds they bind to
127.0.0.1inside the enclave, where nothing can reach them. So we have no latency, error or traffic numbers for the TEE.What changes
/metricson vsock port 9090 (profile.MetricsVsockPort). The parent host forwards it to Prometheus (companion infrastructure PR).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 byinstance(premium-1/nexus-tee-1) to compare them.Checked
go build ./...,go vetfor both the ordinary and the Nitro build, andgo test ./...pass.Not checked: the vsock listener itself, which needs a real Nitro host. It uses the same
vsock.Listencall 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-1as down until then.🤖 Generated with Claude Code