fix: Reliably show service and level in pattern sample drawer - #3062
fix: Reliably show service and level in pattern sample drawer#3062pulpdrew wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: 8c2e213 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThe PR explicitly selects service name and source-appropriate level values under stable aliases so event-pattern lists and sample drawers can display them reliably.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| packages/app/src/hooks/usePatterns.tsx | Explicitly projects service and source-appropriate level expressions under stable aliases and carries level into grouped pattern rows. |
| packages/app/src/components/PatternTable.tsx | Supplies service and level expressions to pattern sampling and displays the normalized level field. |
| packages/app/src/components/PatternSidePanel.tsx | Reads sample service and level values through stable aliases in the drawer table. |
| packages/app/src/components/AISummarizePatternButton.tsx | Builds AI summary input from the same normalized service and level aliases. |
| packages/app/src/components/DBRowTable.tsx | Uses the normalized pattern level for trend coloring and updates denoising queries to use the shared level-expression helper. |
| packages/app/src/source.ts | Adds a helper selecting severity text for logs and status code for traces. |
| packages/app/tests/e2e/features/search/event-patterns.spec.ts | Covers service-name rendering outside the primary key and trace status-code rendering as level. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
S[Selected log or trace source] --> E[getLevelExpression]
S --> N[Service-name expression]
E --> Q[Pattern sampling query]
N --> Q
Q --> A[Stable service and level aliases]
A --> G[Grouped patterns]
A --> D[Sample drawer]
G --> T[Pattern list]
A --> AI[AI summary input]
Reviews (4): Last reviewed commit: "fix: Show level for traces in pattern si..." | Re-trigger Greptile
E2E Test Results✅ All tests passed • 334 passed • 1 skipped • 1206s
Tests ran across 4 shards in parallel. |
2ebb466 to
01c04ce
Compare
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
Deep Review✅ No critical issues found. The rename from 🟡 P2 -- recommended
🔵 P3 nitpicks (2)
Reviewers (4): testing, maintainability, kieran-typescript, previous-comments. Testing gaps:
|
PR Review5 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 5 minor 4 posted as inline comment(s) on the changed lines. 1 listed below. Findings outside the changed lines1 minor
Severity is the reviewer's own estimate and is used for ordering, not filtering. |
Summary
This PR fixes two issues with the event patterns sample table:
servicefor sources where theserviceNameExpressionis not in the Primary Key (or where the Primary Key could not be accurately read by HyperDX due to distributed/merge table topologies).levelfor trace sourcesRoot causes:
usePatternsnever explicitly selected ServiceName in the first place, rather it just so happened that the ServiceName was added to the select by another optimization (appendSelectWithAdditionalKeys) which adds columns from the primary key.usePatternsqueries StatusCode, but the table did not read it, it was hardcoded to read SeverityText instead.This fix updates the usePatterns query to explicitly query the correct columns under known alias names that are then referenced by those aliases in the PatternTable. This PR also includes E2E covering these cases.
Screenshots
Before:
Trace source level undefined
Missing Service:
After:
Trace source level defined
Service shown
Testing
If you'd like to test the service name case, use this as a source:
References
Linear: Closes HDX-5274