include memory logger - #1
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in development memory logger (controlled by LOG_MEMORY) so developers can observe the app process’ RSS usage during navigation, helping validate memory headroom for constrained deployments.
Changes:
- Introduces
src/memory_log.pyto print RSS memory usage on demand. - Adds
LOG_MEMORYwiring insrc/app.pyto log once on URL/pathname changes. - Documents the feature in
README.md/.env.exampleand addspsutiltorequirements-dev.txt.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/memory_log.py | New utility for printing current process RSS memory usage. |
| src/app.py | Adds LOG_MEMORY env toggle and calls the logger on navigation. |
| requirements-dev.txt | Adds psutil as a dev dependency. |
| README.md | Documents how to enable memory logging via .env. |
| .env.example | Adds LOG_MEMORY configuration and usage notes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
What changed
Adds a memory logger for development purposes. The tool is controlled by a single variable in the .env file, "LOG_MEMORY". When set to true, the logger prints the used memory to terminal every time the user navigates to a new page.
Why
Included as a development tool, as we know that the 4insight implementation of python dashboards will have limited memory.
Definition of done
CI covers the first two. The rest are yours — tick them because you did them,
not because they were already ticked. See
CONTRIBUTING.mdfor why each is here.pytestpassesblackis cleanAnything the reviewer should look at closely
Check if you think the logging interval make sense. I tried to do a "timed" version, i.e. log memory usage every 30 sec, but I figured at navigation is more useful.