Skip to content

feat: add user_name, team_ids, team_names, customer_ids, customer_names, business_unit_ids, business_unit_names to log list select columns - #4866

Merged
akshaydeo merged 2 commits into
devfrom
07-03-fix_add_extra_columns_in_api_logs_api
Jul 3, 2026
Merged

feat: add user_name, team_ids, team_names, customer_ids, customer_names, business_unit_ids, business_unit_names to log list select columns#4866
akshaydeo merged 2 commits into
devfrom
07-03-fix_add_extra_columns_in_api_logs_api

Conversation

@impoiler

@impoiler impoiler commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Expands the log store query to include additional user, team, customer, and business unit fields when listing log entries.

Changes

  • Added user_name to the select columns alongside user_id
  • Added plural association columns (team_ids, team_names, customer_ids, customer_names, business_unit_ids, business_unit_names) to support multi-value relationships on log entries

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

go test ./...

Query the log listing endpoint and verify that user_name, team_ids, team_names, customer_ids, customer_names, business_unit_ids, and business_unit_names are returned in the response.

Screenshots/Recordings

N/A

Breaking changes

  • Yes
  • No

Related issues

Security considerations

The newly selected columns (user_name, team_ids, team_names, customer_ids, customer_names, business_unit_ids, business_unit_names) may contain PII. Ensure existing access control and data masking policies cover these fields before deploying.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The listSelectColumns() function in the log store now selects user_name and adds array-based identity columns for team, customer, and business unit dimensions in log list queries.

Changes

Log list query columns

Layer / File(s) Summary
Update select column list
framework/logstore/rdb.go
Added user_name and appended team_ids/team_names, customer_ids/customer_names, and business_unit_ids/business_unit_names to the log list SELECT column list.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the main change: adding additional log list select columns.
Description check ✅ Passed The description follows the template well and covers summary, changes, type, testing, breaking changes, and security.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 07-03-fix_add_extra_columns_in_api_logs_api

Comment @coderabbitai help to get the list of available commands.

impoiler commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@impoiler
impoiler force-pushed the 07-02-fix_extra_column_accessors_for_logs_table branch from 2452cf2 to 995af61 Compare July 2, 2026 18:35
@impoiler
impoiler force-pushed the 07-03-fix_add_extra_columns_in_api_logs_api branch from 0530e07 to d24da7f Compare July 2, 2026 18:35
@impoiler impoiler changed the title feat: add user_name and plural team/customer/business_unit fields to log list select columns feat: add user_name, team_ids, team_names, customer_ids, customer_names, business_unit_ids, business_unit_names to log list select columns Jul 2, 2026
@impoiler impoiler self-assigned this Jul 2, 2026
@impoiler
impoiler marked this pull request as ready for review July 2, 2026 18:41
@greptile-apps

greptile-apps Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge — the change adds already-migrated, well-typed columns to an existing SELECT list with no impact on write paths.

All seven columns are confirmed present in the Log struct and the database schema via existing migrations. The AfterFind/DeserializeFields hook correctly converts the raw JSON text columns into the virtual *Parsed slice fields that carry the JSON output tags, so the new fields will appear in list API responses exactly as intended. No write paths, filters, indexes, or auth boundaries are touched.

No files require special attention.

Important Files Changed

Filename Overview
framework/logstore/rdb.go Adds user_name and six plural association columns to listSelectColumns(). All referenced columns exist in the Log struct with migrations, and deserialization via AfterFind correctly populates the virtual parsed fields for JSON output.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Client
    participant Handler
    participant RDBLogStore
    participant DB as Database

    Client->>Handler: GET /api/logs
    Handler->>RDBLogStore: SearchLogs(filters, pagination)
    RDBLogStore->>DB: "SELECT id, ..., user_id, user_name,<br/>team_id, team_name, customer_id, customer_name,<br/>business_unit_id, business_unit_name,<br/>team_ids, team_names, customer_ids, customer_names,<br/>business_unit_ids, business_unit_names, ...<br/>FROM logs"
    DB-->>RDBLogStore: []Log rows (raw text for JSON columns)
    Note over RDBLogStore: AfterFind → DeserializeFields()<br/>parses TeamIDs→TeamIDsParsed,<br/>TeamNames→TeamNamesParsed, etc.
    RDBLogStore-->>Handler: "[]Log with *Parsed virtual fields populated"
    Handler-->>Client: "JSON response with team_ids, team_names,<br/>customer_ids, customer_names,<br/>business_unit_ids, business_unit_names,<br/>user_name included"
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Client
    participant Handler
    participant RDBLogStore
    participant DB as Database

    Client->>Handler: GET /api/logs
    Handler->>RDBLogStore: SearchLogs(filters, pagination)
    RDBLogStore->>DB: "SELECT id, ..., user_id, user_name,<br/>team_id, team_name, customer_id, customer_name,<br/>business_unit_id, business_unit_name,<br/>team_ids, team_names, customer_ids, customer_names,<br/>business_unit_ids, business_unit_names, ...<br/>FROM logs"
    DB-->>RDBLogStore: []Log rows (raw text for JSON columns)
    Note over RDBLogStore: AfterFind → DeserializeFields()<br/>parses TeamIDs→TeamIDsParsed,<br/>TeamNames→TeamNamesParsed, etc.
    RDBLogStore-->>Handler: "[]Log with *Parsed virtual fields populated"
    Handler-->>Client: "JSON response with team_ids, team_names,<br/>customer_ids, customer_names,<br/>business_unit_ids, business_unit_names,<br/>user_name included"
Loading

Reviews (2): Last reviewed commit: "fix: add extra columns in api/logs API" | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@framework/logstore/rdb.go`:
- Around line 866-868: The list query in rdb.go is now selecting the new name
fields, but the list response path does not mask them before serialization.
Update the logstore list/query flow around the query builder and result handling
so user_name, team_names, customer_names, and business_unit_names are passed
through the same masking/access-control logic already used for selected-key,
virtual-key, and routing-rule objects, using the relevant list-response handler
or row-mapping code that processes these fields.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fcc60f04-7419-4c8c-951d-a18d16c525c0

📥 Commits

Reviewing files that changed from the base of the PR and between 995af61 and d24da7f.

📒 Files selected for processing (1)
  • framework/logstore/rdb.go

Comment thread framework/logstore/rdb.go
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 2, 2026
@impoiler
impoiler force-pushed the 07-02-fix_extra_column_accessors_for_logs_table branch from 995af61 to b9f6c9d Compare July 3, 2026 04:29
@impoiler
impoiler force-pushed the 07-03-fix_add_extra_columns_in_api_logs_api branch from d24da7f to 14861ba Compare July 3, 2026 04:29

akshaydeo commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Merge activity

  • Jul 3, 4:34 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 3, 4:35 AM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo changed the base branch from 07-02-fix_extra_column_accessors_for_logs_table to graphite-base/4866 July 3, 2026 04:35
@akshaydeo
akshaydeo changed the base branch from graphite-base/4866 to dev July 3, 2026 04:35
@akshaydeo
akshaydeo dismissed coderabbitai[bot]’s stale review July 3, 2026 04:35

The base branch was changed.

@akshaydeo
akshaydeo merged commit 24ff783 into dev Jul 3, 2026
12 checks passed
@akshaydeo
akshaydeo deleted the 07-03-fix_add_extra_columns_in_api_logs_api branch July 3, 2026 04:35
yangtuooc added a commit to yangtuooc/bifrost that referenced this pull request Jul 3, 2026
* upstream/dev:
  feat: adds multiple teams / customers / bus to connectors (maximhq#4875)
  fix: small latency return fixes (maximhq#4876)
  Added missing OpenAI responses methods for lifecycle related tasks (maximhq#3125)
  feat: latency info on errors (maximhq#4867)
  feat: add `user_name`, `team_ids`, `team_names`, `customer_ids`, `customer_names`, `business_unit_ids`, `business_unit_names` to log list select columns (maximhq#4866)
  feat: add multi-value attribution cell with plural fallback for logs columns (maximhq#4865)
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