Skip to content

Conversation

@HarikrishnanK9
Copy link
Contributor

@HarikrishnanK9 HarikrishnanK9 commented Jul 15, 2025

📥 Pull Request

📘 Description

This PR exposes the print_logger function in agentops.logging.instrument_logging at the module level to prevent compatibility issues with libraries like numba that rely on @infer_global(print).

Specifically:

  • Declares print_logger = None at the top of instrument_logging.py
  • Marks print_logger as global inside setup_print_logger() before defining the function
  • Ensures print_logger is accessible as a module-level attribute

This allows Numba to resolve the function via getattr() without raising AttributeError, while preserving AgentOps’ logging behavior.


🧪 Testing

  • ✅ Confirmed agentops.init() works when used with numba-based libraries like openai-whisper
  • ✅ Verified that built-in print() is still intercepted and logged to the buffer logger
  • ✅ Ensured that print_logger appears under dir(agentops.logging.instrument_logging)
  • ✅ Manually tested compatibility with whisper, numba, and CrewAI stack with no crashes

Attaching the before and after stages

Initiall Error Response

Screenshot from 2025-07-15 12-40-34

Successful run after proposed changes in instrument_logging.py file

Screenshot from 2025-07-15 12-45-25

@codecov
Copy link

codecov bot commented Jul 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Dwij1704 Dwij1704 self-requested a review July 16, 2025 21:19
Copy link
Member

@Dwij1704 Dwij1704 left a 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

@HarikrishnanK9
Copy link
Contributor Author

Hi @Dwij1704 , updated the branch. Please let me know if any updates are required from my side.

@dot-agi
Copy link
Member

dot-agi commented Jul 24, 2025

@HarikrishnanK9 thanks for the PR! What's the latest status on this?

@areibman
Copy link
Contributor

Haven't encountered this issue before but seems harmless, let's merge

@areibman areibman enabled auto-merge (squash) July 31, 2025 18:11
@areibman areibman disabled auto-merge July 31, 2025 18:13
@areibman areibman merged commit efdd605 into AgentOps-AI:main Jul 31, 2025
9 of 46 checks passed
@areibman
Copy link
Contributor

thank you @HarikrishnanK9 , going to put this in the next release!!

fenilfaldu pushed a commit that referenced this pull request Aug 4, 2025
Co-authored-by: Dwij <[email protected]>
Co-authored-by: Pratyush Shukla <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants