bloomberg / bloomberg/memray

[feature request]: Ability to reattach live-remote viewers

Open
#791 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
15.2k
Forks
461
Avg merge
5d 3h
Merged PRs (30d)
10

Description

### Is there an existing proposal for this?

- [x] I have searched the existing proposals

### Is your feature request related to a problem?

I'm doing some long-term monitoring of server processes to try and find a leak. I do this by having the server run under memray --live-remote, and looking at it in a memray live tui from an ssh session. If the session times out, I have to end my inspection, because there's no way to reattach.

### Describe the solution you'd like

I would love if memray, when running in `--live-remote`, would
- (ideally) continue to block on start until a viewer connects, though I think it would also be fine to say "start the remote tui before starting the process under inspection"
- upon disconnection of the viewer, reopen a listen socket and start dropping data until something disconnects
- since this is a live view, it seems okay to do this - obviously wouldn't want to for any data aggregation modes

### Alternatives you considered

Having temporal logging also seems like it would work okay so you could inspect it after the fact, but I can see those getting really big - having a live view that's up to the user to inspect at whatever frequency they want is a perfect solution to these kinds of slow leaks in programs with many different internal lifecycles.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the --live-remote entry point and how the live TUI connects to the server over its listen socket. Define the reconnect behavior for viewer disconnects, including whether startup waits for a viewer and how data is handled while none is connected. Done means a disconnected viewer can reconnect to the same live process without stopping inspection.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.