Skip to content

Conversation

@teeohhem
Copy link
Contributor

Fixes: HDX-2787

During live tail, the date range changes every few seconds (e.g., from 9:00-9:15 to 9:02-9:17, etc...). The original aliasMap query key included the entire config object, which contains the dateRange property. Every date range change triggered a refetch of the alias map, even though aliases are derived from the SELECT statement and not from the date range.

While refetching, react-query sets aliasMap to undefined. This caused column IDs to change. React-table uses column IDs as keys to track resize state, so when the ID changes, it loses the stored width and resets to the default size, causing the visible jitter.

Now we have a consistent aliasMap with the added benefit of less network requests.

Fixes: HDX-2787

During live tail, the date range changes every few seconds (e.g., from 9:00-9:15 to 9:02-9:17, etc...). The original aliasMap query key included the entire config object, which contains the dateRange property. Every date range change triggered a refetch of the alias map, even though aliases are derived from the SELECT statement and not from the date range.

While refetching, react-query sets aliasMap to undefined. This caused column IDs to change.  React-table uses column IDs as keys to track resize state, so when the ID changes, it loses the stored width and resets to the default size, causing the visible jitter.

Now we have a consistent aliasMap with the added benefit of less network requests.
@changeset-bot
Copy link

changeset-bot bot commented Nov 11, 2025

🦋 Changeset detected

Latest commit: 813fc0a

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

This PR includes changesets to release 2 packages
Name Type
@hyperdx/app Patch
@hyperdx/api 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

@vercel
Copy link

vercel bot commented Nov 11, 2025

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

Project Deployment Preview Comments Updated (UTC)
hyperdx-v2-oss-app Ready Ready Preview Comment Nov 12, 2025 6:23pm

Optimize query key for aliasMap to prevent jitter.
@claude
Copy link

claude bot commented Nov 11, 2025

Code Review

Overall Assessment: The fix correctly addresses the live tail jitter issue by optimizing the query key. The approach is sound - excluding absolute dateRange values while preserving duration when needed.

Issues Found:

⚠️ Missing properties in query key → Add timestampValueExpression and implicitColumnExpression to the query key (useChartConfig.tsx:301-312)

  • timestampValueExpression is used in renderSelect (line 618) and affects time bucket generation
  • implicitColumnExpression is used in renderSelectList (line 399) and affects WHERE clause rendering within aggregations

⚠️ Missing filter properties → Add filters and filtersLogicalOperator to the query key

  • filters are rendered in renderWhere and affect the generated SQL (renderChartConfig.ts:742)
  • These properties can change the SELECT structure when filters are applied

⚠️ Consider metricTables property → Review if metricTables affects SELECT clause structure

  • Used in metric chart config translation which may affect the final SELECT
  • Check translateMetricChartConfig to confirm (renderChartConfig.ts:1401-1403)

Positive Aspects:

✅ Correctly excludes absolute dateRange times while preserving duration for granularity changes
✅ Good inline documentation explaining the rationale
✅ Proper changeset included

Recommendation: Address the missing query key properties to ensure aliasMap cache invalidates correctly when those config properties change.

placeholderData: keepPreviousData,
queryKey: ['aliasMap', dbSqlRowTableConfig, 'withPlaceholder'],
});
const { data: aliasMap } = useAliasMapFromChartConfig(dbSqlRowTableConfig);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was actually a workaround for this behavior in another spot. The workaround is to use keepPreviousData. The changes to the query key remove the need for this

@github-actions
Copy link
Contributor

github-actions bot commented Nov 11, 2025

E2E Test Results

All tests passed • 40 passed • 3 skipped • 303s

Status Count
✅ Passed 40
❌ Failed 0
⚠️ Flaky 0
⏭️ Skipped 3

View full report →

@kodiakhq kodiakhq bot merged commit 63fcf14 into main Nov 12, 2025
8 of 9 checks passed
@kodiakhq kodiakhq bot deleted the tom/livetail-jitter branch November 12, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants