feat(events): add requester_ip and requester_user_agent to sandbox.lifecycle.killed event - #3465
Open
AdaAibaby wants to merge 1 commit into
Open
feat(events): add requester_ip and requester_user_agent to sandbox.lifecycle.killed event#3465AdaAibaby wants to merge 1 commit into
AdaAibaby wants to merge 1 commit into
Conversation
…fecycle.killed event When kill_reason is "request" (explicit API DELETE), thread the HTTP client IP and User-Agent from the gin handler through RemoveOpts → gRPC SandboxDeleteRequest → orchestrator Delete handler → ClickHouse event_data. System-initiated kills (orphan, base-template-missing, unknown) pass empty strings and produce no extra fields in the event. Closes e2b-dev#3461
AdaAibaby
force-pushed
the
feat/kill-event-requester-info
branch
from
August 4, 2026 08:49
f487aaf to
f726f0e
Compare
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.
Closes #3461
What
When a sandbox is explicitly killed via
DELETE /sandboxes/{id}, thesandbox.lifecycle.killedClickHouse event now includes two additional fields inevent_data:requester_ip— the client IP as resolved by Gin (c.ClientIP())requester_user_agent— theUser-Agentheader from the HTTP requestThese fields are only populated for
kill_reason: requestkills. Timeout, eviction, and orchestrator-internal kills leave both fields absent.Why
Operators currently cannot tell from ClickHouse which IP or which SDK version initiated an explicit sandbox kill. This change makes that traceable without any external logging.
Changes
sandboxtypes/states.go: addRequesterIP,UserAgenttoRemoveOptshandlers/sandbox_kill.go: populate both fields from the incoming HTTP requestorchestrator.proto: addoptional string requester_ipandoptional string requester_user_agenttoSandboxDeleteRequestshared/pkg/grpc/orchestrator/: regenerated protobuf Go bindingsorchestrator/delete_instance.go: thread the two fields throughRemoveSandbox→removeSandboxFromNode→killSandboxOnNode→ gRPC requestorchestrator/pkg/server/sandboxes.go: write fields intoeventDatabefore publishingVerification
Deployed to dev. Created 3 sandboxes, killed each with a distinct
User-Agent(python-sdk/1.2.3,js-sdk/0.9.1,curl/7.88.0). ClickHouse confirms:(
::1is IPv6 loopback — test requests were sent from localhost on the API server; production traffic will carry real client IPs.)/cc @ben-fornefeld @jakubno @dobrac @ValentaTomas @arkamar @tvi Looking forward to your code review.