Skip to content

✨ Add Langfuse tracing for R2R model calls - #14

Closed
lexenson wants to merge 1 commit into
interloom:mainfrom
lexenson:add-langfuse-tracing
Closed

lexenson wants to merge 1 commit into
interloom:mainfrom
lexenson:add-langfuse-tracing

Conversation

@lexenson

Copy link
Copy Markdown

Why

R2R model operations currently arrive in Langfuse without workflow-specific trace names, which makes ingestion costs and related generations difficult to group and analyze.

What changed

  • Add request-scoped trace and observation contexts that merge into LiteLLM metadata.
  • Give each document ingestion one stable trace ID across Hatchet boundaries, with document and task identifiers on the trace.
  • Name ingestion, search, and media operations and attach r2r workflow tags.
  • Keep chunk IDs and page numbers on individual generations so concurrent operations do not overwrite shared trace metadata.
  • Add provider-level fallback names and the r2r tag so LiteLLM completion and embedding calls remain identifiable outside explicitly instrumented workflows.

Testing

  • 32 affected unit tests passed.
  • Ruff checks passed for all changed production files.
  • git diff --check passed.

Deployment note

This relies on the existing LiteLLM Langfuse callback consuming trace_name, generation_name, tags, trace_id, and trace_metadata from request metadata.

@lexenson

Copy link
Copy Markdown
Author

Closing this for a simpler solution for now with less data tracked

@lexenson lexenson closed this Aug 31, 2026
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.

1 participant