Skip to content

feat(webui): surface user, client IP and user agent in API traces (#10886, #10887)#10907

Merged
mudler merged 1 commit into
masterfrom
feat/10886-10887-trace-user-ip-ua
Jul 17, 2026
Merged

feat(webui): surface user, client IP and user agent in API traces (#10886, #10887)#10907
mudler merged 1 commit into
masterfrom
feat/10886-10887-trace-user-ip-ua

Conversation

@localai-org-maint-bot

Copy link
Copy Markdown
Collaborator

What

The Operate → Traces → API Traces panel already recorded who issued each request (user_id / user_name) but never displayed it, and did not capture the caller's network identity at all. This adds the requested fields:

so an operator can attribute a trace to who/what made the request.

Changes

Backend (core/http/middleware/trace.go)

  • Add ClientIP and UserAgent to APIExchange, populated from echo's c.RealIP() (honours X-Forwarded-For / X-Real-IP behind a trusted proxy) and the request's User-Agent header.
  • Both are omitempty; the /api/traces swagger response is map[string]any, so the change is purely additive — no schema regen needed.

UI (core/http/react-ui/src/pages/Traces.jsx)

  • Add a sortable User column to the API traces table.
  • Add a metadata block (User / Client IP / User Agent) at the top of the expanded row detail.
  • Fields render only when present, so older buffered traces and unauthenticated/local requests degrade cleanly.

Tests — new e2e/traces-metadata.spec.js covering the User column value and the expanded Client IP / User Agent metadata.

Notes

  • Backend traces (per-model operations) have no HTTP request context, so this applies to the API Traces tab only, which is where the request-level metadata lives.
  • The remaining sibling issue Jobs monitor - Add running and queued jobs in traces view. #10885 (show live/queued jobs in the traces view) is a larger, separate change and is intentionally out of scope here.

Verification

  • npm run build and eslint on the changed UI pass (0 errors).
  • Go change is gofmt-clean; the full Go build / browser e2e gate run in CI (the local box lacks the generated-protobuf toolchain to build the UI test server).

Closes #10886
Closes #10887

Assisted-by: Claude:opus-4.8 [Claude Code]

…0886, #10887)

The Operate → Traces "API Traces" panel already recorded who made each
request (user_id/user_name) but never showed it, and did not capture the
caller's network identity at all. Operators asked to see the requesting
user (#10886) and the client IP + user agent (#10887) so a trace can be
attributed to who/what issued it.

Backend: add ClientIP and UserAgent to APIExchange and populate them from
echo's c.RealIP() (honours X-Forwarded-For / X-Real-IP behind a trusted
proxy) and the request's User-Agent header. Both are omitempty and the
/api/traces swagger response is map[string]any, so this is additive.

UI: add a sortable "User" column to the API traces table and a metadata
block (User / Client IP / User Agent) at the top of the expanded row
detail. Fields render only when present, so older buffered traces and
unauthenticated/local requests degrade cleanly.

Adds an e2e spec covering the new column value and the expanded metadata.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Assisted-by: Claude:opus-4.8 [Claude Code]
@mudler
mudler merged commit 4be6e22 into master Jul 17, 2026
23 checks passed
@mudler
mudler deleted the feat/10886-10887-trace-user-ip-ua branch July 17, 2026 21:47
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.

Jobs Monitor - Add Client IP and User Agent Jobs Monitor - Add a field containing the user

2 participants