-
Notifications
You must be signed in to change notification settings - Fork 499
Update instrument_logging.py #1150
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Dwij1704
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.
Pass ruff and GTG
|
Hi @Dwij1704 , updated the branch. Please let me know if any updates are required from my side. |
|
@HarikrishnanK9 thanks for the PR! What's the latest status on this? |
|
Haven't encountered this issue before but seems harmless, let's merge |
|
thank you @HarikrishnanK9 , going to put this in the next release!! |
Co-authored-by: Dwij <[email protected]> Co-authored-by: Pratyush Shukla <[email protected]>
📥 Pull Request
📘 Description
This PR exposes the
print_loggerfunction inagentops.logging.instrument_loggingat the module level to prevent compatibility issues with libraries likenumbathat rely on@infer_global(print).Specifically:
print_logger = Noneat the top ofinstrument_logging.pyprint_loggerasglobalinsidesetup_print_logger()before defining the functionprint_loggeris accessible as a module-level attributeThis allows Numba to resolve the function via
getattr()without raisingAttributeError, while preserving AgentOps’ logging behavior.🧪 Testing
agentops.init()works when used withnumba-based libraries likeopenai-whisperprint()is still intercepted and logged to the buffer loggerprint_loggerappears underdir(agentops.logging.instrument_logging)whisper,numba, and CrewAI stack with no crashesAttaching the before and after stages
Initiall Error Response
Successful run after proposed changes in instrument_logging.py file