fix(backend): add server startup time log in main.py (#3870) - #3961
fix(backend): add server startup time log in main.py (#3870)#3961singhanurag0317-bit wants to merge 1 commit into
Conversation
…oti#3870) Log the exact UTC timestamp of server initialization at startup for observability and debugging purposes. Closes riteshbonthalakoti#3870
|
Someone is attempting to deploy a commit to the ritesh Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThe FastAPI lifespan startup handler now records the current UTC timestamp and prints a server initialization message before the existing model-loading sequence. ChangesServer startup logging
Estimated code review effort: 1 (Trivial) | ~2 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
backend/main.py (1)
221-222: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
datetime.now(datetime.timezone.utc)for this startup timestamp.
datetime.datetime.utcnow()is deprecated in Python 3.12 for returning a naive UTC datetime. This workflow runs with Python 3.12, so replace it with an aware UTC clock to preserve explicit UTC semantics.Proposed fix
- startup_time = datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC") + startup_time = datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d %H:%M:%S UTC")🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@backend/main.py` around lines 221 - 222, Update the startup timestamp initialization near the server initialization log to use an aware UTC datetime via datetime.now(datetime.timezone.utc) instead of datetime.datetime.utcnow(), while preserving the existing formatting and startup message.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@backend/main.py`:
- Around line 221-222: Update the startup timestamp initialization near the
server initialization log to use an aware UTC datetime via
datetime.now(datetime.timezone.utc) instead of datetime.datetime.utcnow(), while
preserving the existing formatting and startup message.
Log the exact UTC timestamp of server initialization at startup for observability. Closes #3870
Summary by CodeRabbit