-
Notifications
You must be signed in to change notification settings - Fork 577
UN-3159 [MISC] Add improved logging for retrieval operations #1747
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
UN-3159 [MISC] Add improved logging for retrieval operations #1747
Conversation
- Add cache statistics logging to variable_replacement lru_cache (logs every 50 calls with hit rate, cache size) - Move retry logging in simple retriever to only log when actually retrying (not for initial attempts) - Optimize json_repair_helper with heuristic to skip double parsing when unnecessary - Add detailed retrieval metrics logging to services/retrieval.py for better observability Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughThese changes enhance logging and instrumentation across retrieval and variable extraction modules. SimpleRetriever logging is adjusted for retry reporting, variable extraction introduces a caching layer with statistics tracking, and retrieval operations now capture and log timing metrics alongside contextual information. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
prompt-service/src/unstract/prompt_service/utils/json_repair_helper.py
Outdated
Show resolved
Hide resolved
Remove the heuristic optimization - keeping only logging improvements in this PR. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
harini-venkataraman
left a comment
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.
LGTM
|
Test ResultsSummary
Runner Tests - Full Report
SDK1 Tests - Full Report
|



What
Why
How
retrieval.pyandsimple.pyto track retrieval operation flowvariable_replacement.pyto report hit rate, cache size, and prompt sizejson_repair_helper.pyto skip unnecessary double parsing when working with single JSON objectsCan this PR break any existing features. If yes, please list possible items. If no, please explain why.
No. These are additive changes that only add logging and a minor optimization. No API changes or data model modifications.
Database Migrations
Env Config
Relevant Docs
Related Issues or PRs
Dependencies Versions
Notes on Testing
These changes should be tested by:
Screenshots