Repository navigation
Conversation
The ttfb.py (time to first byte) measures how long it takes ncps to respond back with the first byte, very useful to manually detect regressions causing #660
Summary of ChangesHello @kalbasit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new Python-based development script, Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new development script, ttfb.py, to measure the 'time to first byte' for HA deployments. This is a valuable tool for performance testing. The script is well-written, leveraging asyncio and httpx for parallel requests. My feedback focuses on improving the script's robustness by suggesting more specific exception handling and making the response parsing more resilient. The update to the Nix development shell to include httpx is correct and necessary.
| except Exception as e: | ||
| return {"port": port, "error": str(e)} |
There was a problem hiding this comment.
Catching a generic Exception is too broad and can hide unexpected errors or bugs in the code. It's better to catch more specific exceptions. For network-related errors other than timeouts, httpx.RequestError is a good choice. A similar broad exception is caught on line 55.
| except Exception as e: | |
| return {"port": port, "error": str(e)} | |
| except httpx.RequestError as e: | |
| return {"port": port, "error": str(e)} |
| nar_path = next( | ||
| line.split(": ")[1].strip() | ||
| for line in resp.text.splitlines() | ||
| if line.startswith("URL:") | ||
| ) |
There was a problem hiding this comment.
The use of line.split(': ') to parse the narinfo response is a bit fragile. It assumes there will always be a single space after the colon. To make the parsing more robust against formatting variations (e.g., no space, multiple spaces), it's better to split only on the first colon and then strip whitespace from the result.
| nar_path = next( | |
| line.split(": ")[1].strip() | |
| for line in resp.text.splitlines() | |
| if line.startswith("URL:") | |
| ) | |
| nar_path = next( | |
| line.split(":", 1)[1].strip() | |
| for line in resp.text.splitlines() | |
| if line.startswith("URL:") | |
| ) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #794 +/- ##
=======================================
Coverage 85.41% 85.41%
=======================================
Files 2 2
Lines 480 480
=======================================
Hits 410 410
Misses 65 65
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin release-0.8
git worktree add -d .worktree/backport-794-to-release-0.8 origin/release-0.8
cd .worktree/backport-794-to-release-0.8
git switch --create backport-794-to-release-0.8
git cherry-pick -x 033b2ca46225116ceebbaf76cb638bf5dd538c0b |

The ttfb.py (time to first byte) measures how long it takes ncps to
respond back with the first byte, very useful to manually detect
regressions causing #660