mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #159] [MERGED] fix(gateway): proxy sandbox-routed envd metrics requests #216
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#216
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/AgentENV/pull/159
Author: @feimingxliu
Created: 8/12/2026
Status: ✅ Merged
Merged: 8/17/2026
Merged by: @LSX-s-Software
Base:
main← Head:fix/gateway-envd-metrics📝 Commits (1)
b1e9b0efix(gateway): proxy sandbox-routed metrics requests📊 Changes
4 files changed (+169 additions, -76 deletions)
View changed files
📝
services/gateway/internal/metrics.go(+5 -5)📝
services/gateway/internal/metrics_test.go(+62 -0)📝
services/gateway/internal/server.go(+10 -7)📝
services/gateway/internal/server_test.go(+92 -64)📄 Description
What
/metricsrequests carrying sandbox routing headers to follow the existing Gateway -> runtime node -> sandbox proxy path./metricsto the selected sandbox port./metricsunavailable on the Gateway public HTTP listener./metricsrequests in Gateway HTTP instrumentation while continuing to skip the local reserved endpoint.Why
The Gateway currently returns 404 for every exact
/metricsrequest before it parses host routing, sandbox headers, or scheduler bindings. This blocks the existing envdGET /metricsendpoint even when the caller supplies a valid sandbox ID and target port.The runtime node proxy already supports the remaining path: the Gateway prefixes the request as
/proxy/metrics, and the node strips/proxybefore forwarding it to the sandbox interaction IP and requested port.Related issue
Closes #151
Related but not equivalent: #5 tracks the unimplemented E2B sandbox metrics API. This PR only fixes generic proxy access to the existing raw envd endpoint.
Scope and non-goals
Included:
/healthand/metricsreserved paths./metrics.Not included:
GET /sandboxes/{sandboxID}/metricsor aggregate sandbox metrics endpoints.Design and behavior changes
For exact
/healthand/metrics, the Gateway now resolves the routing boundary before choosing local behavior:A routing header set that omits the sandbox ID continues to return 400. Invalid host-based routes continue through the existing proxy error mapping.
Gateway Prometheus metrics remain on the separate metrics listener, default
:9102; this PR does not expose them from the public HTTP listener.Compatibility and operations
Validation
make fmtmake clippymake test-unitmake -C services test(required whenservices/changes)maketargetCommands and results:
Skipped checks and reasons:
/metricsconform to that contract.Risks and reviewer notes
The main compatibility boundary is preserving the reserved local endpoints. Tests verify:
/healthand/metricsreach/proxy/healthand/proxy/metricson the selected runtime node;/healthand/metricsinject the sandbox ID and target port;/metricsremains 404;/healthand/metricsremain 400;/healthand/metricsbypass Gateway HTTP instrumentation.Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.