Skip to content
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] langfuse tracing layer #498

Draft
wants to merge 5 commits into
base: v1.0
Choose a base branch
from
Draft

Conversation

ahau-square
Copy link
Collaborator

@ahau-square ahau-square commented Dec 18, 2024

Added a tracing layer that translates Rust tracing events to locally hosted Langfuse server via Langfuse API.

The layer:

  • Converts tracing spans and events to Langfuse observations, capturing model completions and tool calls
  • Maintains parent-child span relationships
  • Batches events for efficient sending
  • Records metadata and input/output data

Usage
Set LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY env variables for auth to your local Langfuse server

The traces are also written to a log file in ~/.config/goosse/logs

todo

  • add tracing on additional providers (currently only on databricks provider)
  • add script for deploying local langfuse server (same one as in goose v0)
  • add flag for enabling/disabling tracing
  • add tracing initialization to goose-server (currently only initialized in CLI)

image

@ahau-square
Copy link
Collaborator Author

ahau-square commented Dec 19, 2024

@ajgray-stripe as you may have seen we're porting goose over to rust. Wanted to get your thoughts on this first pass at adding in tracing and how we might adapt it to make your observability system easily pluggable

@ajgray-stripe
Copy link
Contributor

Hey @ahau-square, thanks for the heads-up on this work! I rearranged what you've got into a couple different files (nothing too major as regards functionality, hopefully) and came up with this. (fft cherry-pick; I would have committed to your branch but I don't have the permissions to)

basically, the idea is that ObservationLayer struct handles the common parts + glue code e.g. methods that the native tracing crate requires, and BatchManager implementations get specific details. Most of the new code in different observers will just have to implement different versions of add_event and send in there, and the code in observation_layer.rs abstracts over everything else needed.

please lmk if that makes sense!

confirmed that the refactor works on my machine
image

One thing that this would still be missing is a "plugin system" of registering observer layers without needing to explicitly enumerate them in main.rs. Not really sure yet what the best way to do that is, but that doesn't necessarily have to block this

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.

2 participants