fix: update runtime logs by ogzhanolguncu ยท Pull Request #5351 ยท unkeyed/unkey
๐ Walkthrough
Walkthrough
Consolidates container log columns into a single composite column and extends logs end-to-end with region and instance_id: UI, filters, query/hooks, schemas, TRPC routers (including listInstances), ClickHouse query, and instance resolution logic.
Changes
| Cohort / File(s) | Summary |
|---|---|
Container Logs Table UI web/apps/dashboard/app/(app)/.../container-logs-table/columns.tsx, .../deployment-container-logs-table.tsx, .../skeletons.tsx |
Replaced separate time/severity/message columns with a single composite log column that renders timestamp, severity icon, region flag/label, instance_id, and truncated message. Consolidated three skeleton components into ContainerLogRowSkeleton. ContainerLogRow type adds instance_id and region. |
Runtime Logs Filters (UI) .../logs/components/controls/components/runtime-logs-filters/index.tsx, .../runtime-logs-instance-filter.tsx, .../runtime-logs-region-filter.tsx, .../runtime-logs-deployment-filter.tsx |
Added Region and Instance multi-select filter components and integrated them into FILTER_ITEMS and filter-counting logic. Adjusted deployment option rendering presentation. |
Runtime Logs Query & Hooks (UI) .../details/active-deployment-card-logs/hooks/use-runtime-logs.tsx, .../hooks/use-runtime-logs-filters.ts, .../table/hooks/use-runtime-logs-query.ts |
Propagates region and instanceId through TRPC query inputs and URL params; maps UI filters into query payload when present. |
Runtime Logs Display (UI) .../table/runtime-logs-table.tsx, .../table/runtime-log-details/index.tsx |
Log identity key now includes instance_id. Added an Instance ID column and reordered details to display Instance ID alongside Deployment ID; adjusted Region cell styling. |
Schemas (Dashboard) web/apps/dashboard/lib/schemas/runtime-logs.filter.schema.ts, web/apps/dashboard/lib/schemas/runtime-logs.schema.ts |
Added region and instanceId filter fields and enum entries. Introduced dashboardRuntimeLog schema containing region and instance_id and updated request/response schemas to accept/emit these fields. |
TRPC Runtime Logs (Server) web/apps/dashboard/lib/trpc/routers/deploy/runtime-logs/query.ts, .../deployment/runtime-logs.ts, .../utils.ts, .../llm-search/utils.ts, web/apps/dashboard/lib/trpc/routers/index.ts, .../list-instances.ts |
Added listInstances procedure. Query flow now pre-resolves instanceId filters to k8s pod names, includes k8sPodNames and region in ClickHouse request, post-processes ClickHouse results to resolve k8s_pod_name โ instance_id (with fallback), and augments output with instance_id and region. |
ClickHouse Integration web/internal/clickhouse/src/runtime-logs.ts |
Request schema accepts region and k8sPodNames; runtime log rows include k8s_pod_name. SQL query conditionally filters by region and k8s_pod_name and selects k8s_pod_name in results. |
Runtime Logs Search / LLM Guidance .../llm-search/utils.ts, .../runtime-logs-search/index.tsx |
Expanded LLM prompt guidance and examples to cover filtering and mapping for region, instanceId, and deploymentId, and updated related mapping/ambiguity rules. |
Sequence Diagram
sequenceDiagram
actor User
participant UI as Runtime Logs UI
participant Filters as Filter Hooks
participant QueryHook as Query Hook
participant TRPC as TRPC Router
participant DB as Database
participant CH as ClickHouse
User->>UI: select region and/or instance filters
UI->>Filters: update filter state / URL params
Filters->>QueryHook: provide parsed filters (region, instanceId, ...)
QueryHook->>TRPC: call getRuntimeLogs({ region, instanceId, ... })
TRPC->>DB: pre-resolve instanceId -> k8s pod names (known mapping)
DB-->>TRPC: return k8sPodNames
TRPC->>CH: query logs filtered by region and k8s_pod_name
CH-->>TRPC: return logs with k8s_pod_name
TRPC->>DB: resolve remaining k8s_pod_name -> instance_id
DB-->>TRPC: return podName -> instance_id map
TRPC->>TRPC: enrich logs with instance_id and region
TRPC-->>QueryHook: return enriched logs
QueryHook-->>UI: render logs (composite column: timestamp, severity, region flag, instance_id, message)
Estimated code review effort
๐ฏ 4 (Complex) | โฑ๏ธ ~45 minutes
๐ฅ Pre-merge checks | โ 3
โ Failed checks (2 warnings, 1 inconclusive)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Description check | โ ๏ธ Warning | The PR description provides high-level context with screenshots but lacks detailed implementation information and omits required sections from the template. | Complete the description template by filling in: the issue number, Type of change checkboxes, testing instructions ('How should this be tested?'), and all Required checklist items. |
| Docstring Coverage | โ ๏ธ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
| Title check | โ Inconclusive | The title 'fix: update runtime logs' is vague and does not clearly convey the specific changes made (adding instanceId and region filtering/fields). | Consider using a more descriptive title such as 'feat: add instanceId and region filtering to runtime logs' to better reflect the functional changes introduced. |
โ๏ธ Tip: You can configure your own custom pre-merge checks in the settings.
โจ 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
update-runtime-logs
๐ Coding Plan
- Generate coding plan for human review comments
Comment @coderabbitai help to get the list of available commands and usage tips.