Skip to content

Commit

Permalink
Working
Browse files Browse the repository at this point in the history
  • Loading branch information
HowieG committed May 16, 2024
1 parent ed9d7b3 commit 33f7eb7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions agentops/meta_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __new__(cls, name, bases, dct):

return super().__new__(cls, name, bases, dct)

def send_exception_to_server(cls, exception, api_key):
def send_exception_to_server(cls, exception, api_key, session):
"""Class method to send exception to server."""
if api_key:
exception_type = type(exception).__name__
Expand All @@ -33,6 +33,9 @@ def send_exception_to_server(cls, exception, api_key):
"host_env": get_host_env()
}

if session:
developer_error["session_id"] = session.session_id

HttpClient.post("https://api.agentops.ai/developer_errors",
safe_serialize(developer_error).encode("utf-8"),
api_key=api_key)
Expand All @@ -48,7 +51,7 @@ def wrapper(self, *args, **kwargs):
logger.warning(f"🖇 AgentOps: Error: {e}")
config = getattr(self, 'config', None)
if config is not None:
type(self).send_exception_to_server(e, self.config._api_key)
type(self).send_exception_to_server(e, self.config._api_key, self._session)
raise e

return wrapper

0 comments on commit 33f7eb7

Please sign in to comment.