-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fixed memory leak and added more profiling middlewares #211
Conversation
Reviewer's Guide by SourceryThis PR addresses a memory leak and enhances profiling capabilities by introducing multiple profiling middlewares. The implementation replaces the single PyInstrument profiler with a more flexible middleware system that supports multiple profiling tools (Memray, PyInstrument, Tracemalloc, and ObjGraph). Additionally, it fixes memory leaks in the player career parser by properly handling BeautifulSoup string extractions. Sequence diagram for profiling middleware selectionsequenceDiagram
actor User
participant App
participant Logger
participant Middleware
User->>App: Send request with profile query
App->>Logger: Log "Profiling is enabled"
App->>Middleware: Add selected profiler middleware
Middleware-->>App: Middleware added
App-->>User: Processed request with profiling
ER diagram for Profiler enum changeserDiagram
Profiler {
string MEMRAY
string PYINSTRUMENT
string TRACEMALLOC
string OBJGRAPH
}
Settings {
string profiler
}
Profiler ||--o{ Settings : "used by"
Class diagram for new profiling middlewaresclassDiagram
class OverFastMiddleware {
+dispatch(Request, Callable) HTMLResponse|JSONResponse
+_dispatch(Request, Callable) HTMLResponse|JSONResponse
}
class MemrayInMemoryMiddleware {
+_dispatch(Request, Callable) HTMLResponse
+generate_html_report(Path) str
}
class PyInstrumentMiddleware {
+_dispatch(Request, Callable) HTMLResponse
}
class TraceMallocMiddleware {
+_dispatch(Request, Callable) JSONResponse
}
class ObjGraphMiddleware {
+_dispatch(Request, Callable) JSONResponse
}
OverFastMiddleware <|-- MemrayInMemoryMiddleware
OverFastMiddleware <|-- PyInstrumentMiddleware
OverFastMiddleware <|-- TraceMallocMiddleware
OverFastMiddleware <|-- ObjGraphMiddleware
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @TeKrop - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Summary by Sourcery
Fix memory leak and enhance profiling capabilities by adding support for multiple profiling middlewares. Update project dependencies to include new profiling tools.
Bug Fixes:
Enhancements:
Build: