Repository navigation
feat(ops): log who made each request and each process's memory - #554
Merged
artempartos merged 1 commit intoOct 24, 2026
Merged
Conversation
Request logs had an always-empty user field, and MCP calls logged nothing but the path, so tracing a request to an account meant matching SQL binds by request id. The web memory leak fixed in #552 grew for weeks before anyone noticed; a periodic GC.stat/RSS line shows the next one as a trend within a day and tells retained Ruby objects from native memory. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Artem Petrov <[email protected]>
artempartos
force-pushed
the
artempartos/observability-memory-log-principal
branch
from
October 24, 2026 10:37
6882595 to
0fdc0bd
Compare
This was referenced Oct 24, 2026
Merged
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.
Summary
Two gaps that made the web memory leak (#552) slow to find and incidents slow to trace.
Who made a request
ApplicationController#append_info_to_payloadsetsuseragain — only when the request already resolved its user. Callingcurrent_userthere would resolve the session for requests that never asked (webhooks, the login page), which touches or forgets session rows.MCPControllerrecords its principal: the user for a personalamcp_token, the terminal session for an agent's session key./mcp,/action_mcpand the credential endpoints, but those lines now carryhost/ip/ff/user/sessioninstead of nothing. Every line gains asession=field.Memory over time
MemoryStatslogs one[memory]line every five minutes per long-running process: role, pid, RSS,heap_live_slots,old_objects, heap pages, GC counts,malloc_increase_bytes. Slots and old objects climbing means retained Ruby objects; RSS climbing while they stay flat means native memory.after_bootedinconfig/puma.rb(web) andconfig/puma_mcp.rb(mcp), frombin/temporal_worker, and from the Solid Queue supervisor/worker/dispatcher/scheduler start hooks (each forked process has its own memory). Off in development and test.Tests
LogrageOptionsTest: sensitive endpoints log who called but never params; other requests log params and user.RequestLogPrincipalTest(new): a signed-in page request carries its user; a request that never looked one up carries none; a personal MCP call carries the token's user, an agent's call its session.MemoryStatsTest(new): line format; not started in test.Run locally in a dev image: those files plus
mcp_controller_test.rbandpersonal_mcp_board_test.rb(71 runs, 0 failures); repo-wide rubocop clean. CI is the verification for the full suite.🤖 Generated with Claude Code