-
Notifications
You must be signed in to change notification settings - Fork 0
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
Move start session to thread #26
Conversation
Co-authored-by: Howard Gil <[email protected]>
🔍 Code Review Summary❗ Attention Required: This push has potential issues. 🚨 Overview
🚨 Critical Issuessecurity (2 issues)1. Potential exposure of sensitive information in logs.📁 File: agentops/session.py 💡 Solution: Current Code: logger.error(f"Could not start session - server could not authenticate your API Key") Suggested Code: logger.error("Could not start session - server could not authenticate the API Key") 2. Potential performance issue due to unnecessary sleep calls.📁 File: tests/test_pre_init.py 💡 Solution: Current Code: time.sleep(1) Suggested Code: # Replace with an asynchronous wait or event-driven logic
Useful Commands
|
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.
Consider implementing the following changes to improve the code.
return False | ||
|
||
jwt = res.body.get("jwt", None) | ||
self.jwt = jwt | ||
if jwt is None: | ||
logger.error( | ||
f"Could not start session - server could not authenticate your API Key" |
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.
Comment: Potential exposure of sensitive information in logs.
Solution: Review logging statements to ensure sensitive information is not included.
!! Make sure the following suggestion is correct before committing it !!
f"Could not start session - server could not authenticate your API Key" | |
logger.error("Could not start session - server could not authenticate the API Key") |
@@ -48,10 +48,20 @@ def test_track_agent(self, mock_req): | |||
assert len(mock_req.request_history) == 0 | |||
|
|||
agentops.init(api_key=self.api_key) | |||
time.sleep(1) |
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.
Comment: Potential performance issue due to unnecessary sleep calls.
Solution: Consider using asynchronous programming or event-driven architecture to handle waiting without blocking.
!! Make sure the following suggestion is correct before committing it !!
time.sleep(1) | |
# Replace with an asynchronous wait or event-driven logic |
📥 Pull Request
📘 Description
Briefly describe the changes you've made.
🧪 Testing
Describe the tests you performed to validate your changes.