agentops icon indicating copy to clipboard operation
agentops copied to clipboard

Issue #45 Emit events on exit

Open stateofkate opened this issue 1 year ago โ€ข 1 comments

๐Ÿ“ฅ Pull Request

๐Ÿ“˜ Description

  1. Added self.record(event) before we try to get the return value of a function that is decorated
  2. Modified the worker add_event function such that it updates events if they have the same ID, such that if there is a return value of a decorated function, it is updated to the event, but that if the function terminates, the event is already present

๐Ÿ”„ Related Issue (if applicable) Issue #45 Emit Events on Exit

๐Ÿงช Testing Installed local version of modified agentops package and ran it against some decorated functions. Terminate execution with ctrl + c and saw that the failed event was included in dashboard.

stateofkate avatar Apr 30 '24 17:04 stateofkate

@stateofkate Change on SDK side theoretically works, but we'll need to update:

  1. Server side does not support event upserts. So, it technically would not work.
  2. Unit tests. They're failing because it's expecting the post count == 2, but you made 3. The 3rd is supposed to update the one of the tests, but we're tracking the raw count. To fix this, we'll have to update the unit test

What your viewing is probably due to the way we flush events. On the dashboard, it looks correct, but database-wise, it is not.

Deferring to @siyangqiu about how we'd proceed with this

areibman avatar Apr 30 '24 21:04 areibman