You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request consolidates duplicated logic for extracting per-LLM-call token usage and stage timings from agent results into a new shared namespace, and integrates Langfuse tracing for RAG runs. The main benefit is to eliminate code duplication and prevent future bugs caused by diverging logic, while also enabling optional tracing of RAG runs through Langfuse. There are no behavior changes to existing CSV output or API responses except for the new tracing feature (which is off by default).
Refactoring: Usage and Stage Timing Extraction
Introduced new namespace digdir.skills.usage containing shared functions for extracting stage timings and token usage from agent results. This replaces duplicated logic in both digdir.sweep.runner and digdir.api.routes.endpoints.openai_compat.
Updated all call sites in digdir.sweep.runner and digdir.api.routes.endpoints.openai_compat to delegate to the new shared functions instead of their local copies, removing the old definitions. [1][2][3][4][5][6][7][8][9]
Feature: Optional Langfuse Tracing
Added configuration options for Langfuse tracing to .env.example, with detailed documentation and warnings about data leaving the deployment.
Integrated Langfuse tracing into the main RAG invocation path (digdir.skills.invoke/invoke-rag), wrapping the entire skill graph execution so that traces are emitted for both successful and failed runs if enabled. [1][2][3]
Codebase Maintenance
Updated namespace requires to use the new digdir.skills.usage and digdir.telemetry.langfuse modules where needed. [1][2][3]
No behavior is changed for existing users unless Langfuse tracing is explicitly enabled and configured. The refactoring ensures future maintainability and reduces risk of bugs from duplicated logic.
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 5a2c7ddd-bc8a-40cd-8521-521275bb70ac
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
🔍 Trigger review
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Add tests for Langfuse payloads, gates, and failures
server/src/digdir/telemetry/langfuse.clj:342
This introduces the production Langfuse integration and its payload construction, environment gate, async dispatch, and failure-swallowing behavior without tests. The repository already tests analogous HTTP integrations by redefining clj-http.client/post (for example server/test/digdir/llm/marker_test.clj:74-85); add deterministic tests for the OTLP payload, disabled/misconfigured gates, error traces, and rejected/failed posts so regressions do not silently turn tracing off.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request consolidates duplicated logic for extracting per-LLM-call token usage and stage timings from agent results into a new shared namespace, and integrates Langfuse tracing for RAG runs. The main benefit is to eliminate code duplication and prevent future bugs caused by diverging logic, while also enabling optional tracing of RAG runs through Langfuse. There are no behavior changes to existing CSV output or API responses except for the new tracing feature (which is off by default).
Refactoring: Usage and Stage Timing Extraction
digdir.skills.usagecontaining shared functions for extracting stage timings and token usage from agent results. This replaces duplicated logic in bothdigdir.sweep.runneranddigdir.api.routes.endpoints.openai_compat.digdir.sweep.runneranddigdir.api.routes.endpoints.openai_compatto delegate to the new shared functions instead of their local copies, removing the old definitions. [1] [2] [3] [4] [5] [6] [7] [8] [9]Feature: Optional Langfuse Tracing
.env.example, with detailed documentation and warnings about data leaving the deployment.digdir.skills.invoke/invoke-rag), wrapping the entire skill graph execution so that traces are emitted for both successful and failed runs if enabled. [1] [2] [3]Codebase Maintenance
digdir.skills.usageanddigdir.telemetry.langfusemodules where needed. [1] [2] [3]No behavior is changed for existing users unless Langfuse tracing is explicitly enabled and configured. The refactoring ensures future maintainability and reduces risk of bugs from duplicated logic.