Skip to content

feat: field filtering and priority classification - #1835

Merged
fleon merged 6 commits into
mainfrom
event-deltas/field-filtering
Mar 4, 2026
Merged

fleon merged 6 commits into
mainfrom
event-deltas/field-filtering

Conversation

@alex-fedotyev

Copy link
Copy Markdown
Contributor

Summary

Closes #1825

  • Field classification functions in deltaChartUtils.ts:
    • stripTypeWrappers() — removes LowCardinality(...) and Nullable(...) wrappers from ClickHouse type strings
    • isIdField() — detects structural ID fields (top-level String or Array(String) ending in "Id"/"ID")
    • isTimestampArrayField() — detects per-index timestamp array elements from Array(DateTime64(...)) columns
    • isDenylisted() — combined: ID fields + timestamp arrays
    • isHighCardinality() — detects fields where min(outlierUniqueness, inlierUniqueness) > 0.9 with combined sample > 20
  • getPropertyStatistics now also returns propertyOccurences and valueOccurences (needed for cardinality detection)
  • Two-section layout in DBDeltaChart.tsx:
    • Properties split into visibleProperties (primary) and hiddenProperties (denylisted + high-cardinality)
    • Rendered in two separate CSS grids with a "Lower-priority fields (N)" divider
    • Row-based pagination: hidden fields always start from column 1 (not filling incomplete visible rows)
  • Tests: 29 unit tests covering all classification functions + integration test

Test plan

  • TraceId, SpanId, ParentSpanId appear in "Lower-priority fields" section
  • Events.Timestamp[N] elements appear in lower-priority section
  • High-cardinality fields (>90% unique values, sample > 20) appear in lower-priority section
  • Low-cardinality fields like http.method stay in primary section
  • Hidden fields start from column 1 on their grid rows
  • Pagination correctly accounts for both sections' row counts
  • Small sample sizes (≤ 20 combined) keep fields visible regardless of uniqueness
  • Run npx jest src/components/__tests__/deltaChartFieldClassification.test.ts — 29 tests pass

🤖 Generated with Claude Code

- deltaChartUtils: add stripTypeWrappers, isIdField, isTimestampArrayField,
  isDenylisted, isHighCardinality classification functions
- getPropertyStatistics now also returns propertyOccurences and
  valueOccurences (needed for cardinality detection)
- DBDeltaChart: split properties into visible (primary) and hidden
  (denylisted + high cardinality) with two separate CSS grids
- Row-based pagination: hidden fields always start from column 1
- "Lower-priority fields (N)" divider between sections
- Tests: 29 unit tests covering all classification functions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Mar 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hyperdx-oss Ready Ready Preview, Comment Mar 3, 2026 11:47pm

Request Review

@changeset-bot

changeset-bot Bot commented Mar 2, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4e8b4d6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Patch
@hyperdx/api Patch
@hyperdx/otel-collector Patch

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

@github-actions

github-actions Bot commented Mar 2, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 77 passed • 4 skipped • 905s

Status Count
✅ Passed 77
❌ Failed 0
⚠️ Flaky 1
⏭️ Skipped 4

Tests ran across 4 shards in parallel.

View full report →

@alex-fedotyev
alex-fedotyev requested review from a team and fleon and removed request for a team March 2, 2026 19:46
@github-actions

github-actions Bot commented Mar 2, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @teeohhem's task in 1m 55s —— View job


PR Review: feat: field filtering and priority classification

✅ No critical issues found. The implementation is clean, well-tested, and follows project patterns.

A few minor observations:

  • ⚠️ Code duplication in deltaChartUtils.ts — the same two-line pattern for extracting colName from a key (regex + ternary) is copy-pasted into both isIdField (lines 143–144) and isTimestampArrayField (lines 167–168). Consider extracting a getBaseColumnName(key) helper to reduce duplication. Fix this →

  • ⚠️ Cardinality blind spot: isHighCardinality uses outlierRawValueOccurences (from valueOccurences), which only tracks fields that appear ≥ MIN_PROPERTY_OCCURENCES (5) times. If a field appears 4 times in the outlier group and 17 in the inlier group (combined 21 > threshold), the outlier group's value map will be absent, resulting in outlierUniqueness = 0, suppressing detection. This is a conservative false-negative (field stays visible) so not harmful, but worth noting.

  • ℹ️ propertyOccurences / valueOccurences (one 'r') typo is consistent with the existing codebase — no change needed.

Address review feedback:
- Extract duplicated colName parsing into getBaseColumnName() helper
- Add unit tests for the new helper (4 tests)
- Add missing changeset for the PR

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Mar 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @alex-fedotyev's task in 30s —— View job


PR Review: feat: field filtering and priority classification

✅ No critical issues found. The previous review's code duplication concern (getBaseColumnName helper) has already been addressed in the latest commit.

Minor observations:

  • ⚠️ isHighCardinality uses outlierRawValueOccurences (raw counts) but receives percentageOccurences for outlier/inlier value maps — Looking at DBDeltaChart.tsx:267-274, outlierRawValueOccurences and inlierRawValueOccurences are passed correctly. The naming in the useMemo shadowing (outlierValueOccurences for percentages vs outlierRawValueOccurences for raw) is a bit confusing at first read, but the logic is correct.

  • ℹ️ Pagination edge case: When visibleProperties is empty and only hiddenProperties exist, showHiddenHeader will be true and showDivider false — the divider/label still renders correctly. Works as intended.

  • ℹ️ getBaseColumnName regex (/^([^[]+)\[(\d+)\]$/) returns null for Events[0][1] but the test at line 44 confirms this is intentional. The "malformed" case is actually a nested array access, correctly excluded.

  • ℹ️ The propertyOccurences/valueOccurences (one 'r') typo noted in a prior review remains consistent with the existing codebase — no change needed.

The implementation is clean, well-tested (29 unit tests), and the two-section layout logic with row-based pagination is correct.

Resolve conflict in deltaChartUtils.ts: keep both applyTopNAggregation
(from merged #1834) and field classification helpers (this branch).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Mar 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @alex-fedotyev's task in 58s —— View job


PR Review: feat: field filtering and priority classification

  • Read changed files
  • Review code

✅ No critical issues found. The implementation is clean and well-tested.

One minor observation:

  • ℹ️ isHighCardinality false-negative edge case (carried over from prior reviews, still applies): valueOccurences only tracks keys with ≥ MIN_PROPERTY_OCCURENCES (5) occurrences. If a field appears < 5 times in one group but ≥ 5 in the other, that group's unique value count will be 0, making Math.min(0, highCardinality) = 0, suppressing detection. This is a conservative false-negative (field stays visible) — no harm done, but worth a comment in the code if future maintainers hit it.

Everything else looks good: getBaseColumnName helper correctly avoids the earlier code duplication, row-based pagination math handles edge cases correctly (empty visible section, page boundaries), and the 29-test suite covers the classification functions well.

@github-actions

github-actions Bot commented Mar 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @alex-fedotyev's task in 1m 17s —— View job


  • Read changed files
  • Review code

✅ No critical issues found.

The getBaseColumnName refactor (from prior review) is in place. Pagination math is correct across edge cases (empty visible section, page boundaries, cross-section pages). Classification functions are sound.

One observation carried over from prior reviews that still applies:

  • ℹ️ isHighCardinality conservative false-negative: valueOccurences only tracks keys with ≥ 5 occurrences (MIN_PROPERTY_OCCURENCES). A field with < 5 outlier observations will have outlierUniqueValues = 0, making outlierUniqueness = 0/total = 0 — Math.min(0, highInlierUniqueness) = 0, suppressing detection even if both groups are genuinely high-cardinality. Field stays visible (false-negative), so no harm done. Worth a one-line code comment if future maintainers hit it.

The two-section layout, row-based pagination, and 29-test suite are all solid.

@fleon
fleon merged commit f5828d1 into main Mar 4, 2026
16 checks passed
knudtty pushed a commit that referenced this pull request Apr 16, 2026
Co-authored-by: Alex Fedotyev <alex@Alexs-CH-Mac.localdomain>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Tom Alexander <teeohhem@gmail.com>

This branch was successfully deployed

1 active deployment
Preview — 4e8b4d6e Deployed Mar 3, 2026 by vercel[bot]
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.

Event Deltas: Field filtering and priority classification

3 participants