-
Notifications
You must be signed in to change notification settings - Fork 36
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
feat: add observability plugin system #227
feat: add observability plugin system #227
Conversation
6136b11
to
59e5716
Compare
nice - looks good to me cc @ahau-square |
I'm getting some different behavior in this for the langfuse tracing - seems like my traces are no longer registering to the same session. Have to dig in more to see why |
Hey @ajgray-stripe Nice work! Codes are clean and easy to read. Thank you! I had same issue as @ahau-square and saw “No trace found in the current context” message when Langfuse tracing is enabled. I had a look, it seems to be related to this code
It seems that the langfuse_context.update_current_trace needs to be called within the observe context. Doc I tried to fix it and created a temp draft PR with the fix and it seems to work #238. |
Thanks for the patches, @lifeizhou-ap -- incorporated those here! (and managed to get langfuse running locally, so confirmed that I see traces there with those changes) |
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.
Thanks for making the fixes for the langfuse integration too, tried it out and seems like the behavior now matches the previous implementation. this lgtm! excited for this!
Description
See #203 for background; summary of that issue is that we'd like to have a somewhat more abstracted plugin system for observability/tracing so that we can have our own house-built telemetry plugin. I ultimately opted for the relatively lightweight option of just copying Langfuse's API for this PR; I wasn't confident enough in a refactor that was any more different.
In particular, the substantive changes made here are:
profiles.yaml
,pyproject
-based entrypoint discovery for plugins, etc.observe_wrapper
decorator into a method that calls all registered observerslangfuse_wrapper.py
code intoobservers/langfuse.py
; I didn't really touch the code in there much. Also makes that plugin a defaultReview commit-by-commit for the logical flow here.
Testing
I also did some manual testing, with a couple minor hacks to get around not actually being able to test fully end-to-end with Langfuse (the environment I'm using didn't make that easy+fast so I just did this instead).
disabling actually authenticating Langfuse
and instead just logging to a file for visibility
, as well as this profile:
we can see that Goose runs correctly, with startup messages showing that it's correctly (trying to) initialize the Langfuse client:
and we correctly log method calls.
--tracing
flag, goose runs without errors as expected: