Repository navigation
feat: fetch key limit now applies per map #3392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@hyperdx/app': patch | ||
| --- | ||
|
|
||
| fix: the search page filter key limit (Filter Keys Fetch Limit, default 100) | ||
| now applies to each Map column, so keys from `LogAttributes` no longer crowd out | ||
| `ResourceAttributes` and other Map columns |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ import { | |
| import { | ||
| Field, | ||
| MetricNames, | ||
| parseKeyPath, | ||
| TableConnection, | ||
| TableMetadata, | ||
| } from '@hyperdx/common-utils/dist/core/metadata'; | ||
|
|
@@ -521,6 +522,30 @@ export function useMultipleGetKeyValues( | |
| if (keys.length === 0) return; | ||
| const usableMVsOverride = | ||
| chartConfigsArr.length === 1 ? metadataMVsOverride : undefined; | ||
| // The limit applies per Map column, so one wide Map (e.g. LogAttributes) | ||
| // can't crowd out the others. Top-level columns share a single limit. | ||
| const { limitedKeys, limitedKeyConditions } = keys.reduce<{ | ||
| countByColumn: Map<string, number>; | ||
| limitedKeys: string[]; | ||
| limitedKeyConditions?: (FilterState | undefined)[]; | ||
| }>( | ||
| (acc, key, i) => { | ||
| const path = parseKeyPath(key); | ||
| const column = path.length > 1 ? path[0] : ''; | ||
|
knudtty marked this conversation as resolved.
Resolved
knudtty marked this conversation as resolved.
Resolved
|
||
| const count = acc.countByColumn.get(column) ?? 0; | ||
| acc.countByColumn.set(column, count + 1); | ||
| if (count < maxKeys) { | ||
|
knudtty marked this conversation as resolved.
Resolved
knudtty marked this conversation as resolved.
Resolved
|
||
| acc.limitedKeys.push(key); | ||
| acc.limitedKeyConditions?.push(keyConditions?.[i]); | ||
| } | ||
| return acc; | ||
| }, | ||
| { | ||
| countByColumn: new Map(), | ||
| limitedKeys: [], | ||
| limitedKeyConditions: keyConditions ? [] : undefined, | ||
| }, | ||
| ); | ||
|
|
||
| const lookups = chartConfigsArr.map(chartConfig => { | ||
| const source = chartConfig.source | ||
|
|
@@ -539,8 +564,8 @@ export function useMultipleGetKeyValues( | |
| lookups.map(({ chartConfig, source }) => | ||
| metadata.getKeyValuesWithMVs({ | ||
| chartConfig, | ||
| keys: keys.slice(0, maxKeys), | ||
| keyConditions: keyConditions?.slice(0, maxKeys), | ||
| keys: limitedKeys, | ||
| keyConditions: limitedKeyConditions, | ||
| limit, | ||
| disableRowLimit, | ||
| source, | ||
|
|
@@ -559,7 +584,7 @@ export function useMultipleGetKeyValues( | |
| metadata.streamAllKeyValues({ | ||
| databaseName: chartConfig.from.databaseName, | ||
| tableName: chartConfig.from.tableName, | ||
| keyExpressions: keys.slice(0, maxKeys), | ||
| keyExpressions: limitedKeys, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The hook now fetches keys beyond the first global Use the same per-map selection for the sidebar's requested-key list so these filters stay visible and keep their order while loading. |
||
| maxValuesPerKey: limit, | ||
| connectionId: chartConfig.connection, | ||
| metadataMVs, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.