fix(logging): avoid loading raw_request/raw_response in log list queries#1934
fix(logging): avoid loading raw_request/raw_response in log list queries#1934Vaibhav701161 wants to merge 2 commits intomaximhq:mainfrom
Conversation
Signed-off-by: Vaibhav mittal <vaibhavmittal929@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds a dedicated GET /api/logs/{id} endpoint and store/plugin methods to retrieve a single log including raw_request/raw_response; list queries now omit raw blobs to reduce payloads. Frontend fetches full log on details open and merges raw fields for display. Changes
Sequence DiagramsequenceDiagram
participant User as User
participant UI as Log Details Sheet
participant API as Frontend API
participant Handler as HTTP Handler
participant Manager as Log Manager
participant Store as Log Store
User->>UI: Open log details (with log.id)
UI->>API: useLazyGetLogByIdQuery(log.id)
API->>Handler: GET /api/logs/{id}
Handler->>Manager: logManager.GetLog(ctx, id)
Manager->>Store: store.FindByID(id)
Store-->>Manager: return Log (includes raw_request/raw_response)
Manager-->>Handler: return Log
Handler-->>API: 200 JSON response
API-->>UI: fullLog data
UI->>UI: merge raw fields (prefer fullLog over initial)
UI->>User: display full log details
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ui/app/workspace/logs/sheets/logDetailsSheet.tsx`:
- Around line 79-82: The current merge uses fullLog unconditionally and can show
stale data from a previously opened entry; change the merge to only use fullLog
when it matches the current log by checking fullLog.id === log.id before falling
back to log values. Update the assignments that produce rawRequest and
rawResponse (referencing fullLog and log in logDetailsSheet.tsx) so they use
fullLog.raw_request / fullLog.raw_response only if fullLog exists and fullLog.id
=== log.id, otherwise use log.raw_request / log.raw_response.
In `@ui/lib/store/apis/logsApi.ts`:
- Around line 330-332: The getLogById query currently interpolates raw id into
the path in the query function for getLogById; update the query builder inside
getLogById to URL-encode the id (e.g., use encodeURIComponent on the id passed
to query) so reserved characters won't break routing—modify the query: (id) =>
`/logs/${encodeURIComponent(id)}` while leaving providesTags and other logic
unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 24951187-a2f0-40ed-866d-14b02b792924
📒 Files selected for processing (7)
framework/logstore/rdb.goframework/logstore/sqlite.goplugins/logging/operations.goplugins/logging/utils.gotransports/bifrost-http/handlers/logging.goui/app/workspace/logs/sheets/logDetailsSheet.tsxui/lib/store/apis/logsApi.ts
|
❤️ for the PR @Vaibhav701161 This looks solid. Actually I had a branch fixing this - but your changes look solid. There is one valid comment by CodeRabbit - could you check that |
Signed-off-by: Vaibhav mittal <vaibhavmittal929@gmail.com>
|
Thanks for the review @akshaydeo |
Summary
When raw request and response logging is enabled, the logs list endpoint (
GET /api/logs) returns the fullraw_requestandraw_responsefields for every log entry. These fields can be quite large for long running prompts or tool-heavy responses.Because of this, the Logs and Dashboard pages can become very slow or appear to load indefinitely when many logs contain large raw payloads.
This change avoids loading those fields in the list query and instead fetches them only when a specific log entry is opened.
Changes
raw_requestandraw_response.SetMaxOpenConns(1)from the SQLite configuration since WAL mode already supports concurrent reads.This keeps the logs list lightweight while still allowing the full raw request/response to be inspected when needed.
Type of change
Affected areas
How to test
Run tests:
go test ./...Build UI:
Manual validation
Expected behavior:
Screenshots / Recordings
Logs page loading normally with raw logging enabled:
Breaking changes
Related issues
Closes #1764
Security considerations
No changes to authentication or access control. Raw payloads remain accessible through the existing log detail view.
Checklist
docs/contributing/README.mdand followed the guidelines