Skip to content

Commit c652777

Browse files
authored
Merge branch 'main' into aaron/stream-filter-key-value-results
2 parents e5f8e22 + 1773c11 commit c652777

67 files changed

Lines changed: 3244 additions & 648 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@hyperdx/common-utils': patch
3+
'@hyperdx/app': patch
4+
---
5+
6+
feat: Broadcast adhoc dashboard filter conditions

‎.changeset/alert-side-panel.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperdx/app': minor
3+
---
4+
5+
feat: Edit chart alerts in a side panel docked beside the chart editor, so the preview chart stays in view while the alert is tuned. "Add alert" / "Edit alert" opens the panel; a new alert is kept with "Add alert" and an existing one with "Update alert", while closing the panel discards the changes. The panel fills the editor's visible height and can be resized from its left edge. Save and Cancel move to the chart name row.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@hyperdx/app': minor
3+
---
4+
5+
feat: add a content font size preference
6+
7+
Small text in the log/trace table was not adjustable without browser zoom, which
8+
also shrinks the surrounding chrome. User preferences now carry a **Content font
9+
size** setting (small / medium / large) that scales the search results table,
10+
data tables, expanded row JSON, and chart axes, legends, and tooltips. Small is
11+
the default and matches the previous sizes, so nothing changes until you opt in.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperdx/app': patch
3+
---
4+
5+
feat: Remember the service map sampling rate in local storage; a `samplingFactor` URL param still takes precedence

‎packages/app/pages/_app.tsx‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { NextApiConfigResponseData } from '@/types';
3333
import { ConfirmProvider } from '@/useConfirm';
3434
import {
3535
SystemColorSchemeScript,
36+
useContentFontSize,
3637
useResolvedColorScheme,
3738
useUserPreferences,
3839
} from '@/useUserPreferences';
@@ -98,6 +99,8 @@ function AppContent({
9899
const { userPreferences } = useUserPreferences();
99100
const resolvedColorScheme = useResolvedColorScheme();
100101
const { themeName } = useAppTheme();
102+
const { base: contentFontSize, compact: compactContentFontSize } =
103+
useContentFontSize();
101104

102105
// ClickStack theme always uses Inter font - user preference is ignored
103106
// HyperDX theme allows user to select font preference
@@ -115,6 +118,21 @@ function AppContent({
115118
}
116119
}, [effectiveFont]);
117120

121+
useEffect(() => {
122+
// Single write point for the content font size preference; tables and
123+
// chart CSS read these vars (see styles/app.scss for the defaults).
124+
if (typeof document !== 'undefined') {
125+
document.documentElement.style.setProperty(
126+
'--hdx-content-font-size',
127+
`${contentFontSize}px`,
128+
);
129+
document.documentElement.style.setProperty(
130+
'--hdx-content-font-size-compact',
131+
`${compactContentFontSize}px`,
132+
);
133+
}
134+
}, [contentFontSize, compactContentFontSize]);
135+
118136
const getLayout = Component.getLayout ?? (page => page);
119137

120138
return (

‎packages/app/src/DBDashboardPage.tsx‎

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ import {
3535
isTimeSeriesDisplayType,
3636
} from '@hyperdx/common-utils/dist/core/utils';
3737
import { getBlockingRequiredFilterNames } from '@hyperdx/common-utils/dist/dashboardFilterValues';
38+
import {
39+
getPromqlFilters,
40+
getSqlFilters,
41+
} from '@hyperdx/common-utils/dist/filters';
3842
import {
3943
displayTypeRequiresSource,
4044
isBuilderChartConfig,
@@ -51,12 +55,12 @@ import {
5155
import { isMissingFiltersMacro } from '@hyperdx/common-utils/dist/macros';
5256
import {
5357
AlertState,
58+
BroadcastFilter,
5459
ChartConfigWithDateRange,
5560
ChartVariable,
5661
DashboardContainer as DashboardContainerSchema,
5762
DashboardFilter,
5863
DisplayType,
59-
Filter,
6064
getSampleWeightExpression,
6165
isLogSource,
6266
isTraceSource,
@@ -467,7 +471,7 @@ const Tile = ({
467471
onSettled?: () => void;
468472
granularity: SQLInterval | undefined;
469473
onTimeRangeSelect: (start: Date, end: Date) => void;
470-
filters?: Filter[];
474+
filters?: BroadcastFilter[];
471475
variables?: ChartVariable[];
472476
/** The dashboard's required filters that have nothing selected. */
473477
unsatisfiedRequiredFilters?: DashboardFilter[];
@@ -650,6 +654,15 @@ const Tile = ({
650654
missingRequiredFilterNames.length > 0 &&
651655
displayTypeRequiresSource(chart.config.displayType);
652656

657+
const sqlFilters = useMemo(
658+
() => (filters ? getSqlFilters(filters) : undefined),
659+
[filters],
660+
);
661+
const promqlFilters = useMemo(
662+
() => (filters ? getPromqlFilters(filters) : undefined),
663+
[filters],
664+
);
665+
653666
useEffect(() => {
654667
if (isPromqlSavedChartConfig(chart.config)) {
655668
if (source != null) {
@@ -660,6 +673,7 @@ const Tile = ({
660673
dateRange,
661674
granularity,
662675
variables: tileVariables,
676+
filters: promqlFilters,
663677
});
664678
}
665679
return;
@@ -672,7 +686,7 @@ const Tile = ({
672686
...chart.config,
673687
dateRange,
674688
granularity,
675-
filters,
689+
filters: sqlFilters,
676690
variables: tileVariables,
677691
});
678692
} else if (source != null) {
@@ -691,7 +705,7 @@ const Tile = ({
691705
sampleWeightExpression: getSampleWeightExpression(source),
692706
dateRange,
693707
granularity,
694-
filters,
708+
filters: sqlFilters,
695709
variables: tileVariables,
696710
});
697711
}
@@ -732,13 +746,21 @@ const Tile = ({
732746
? source.bodyExpression
733747
: undefined,
734748
sampleWeightExpression: getSampleWeightExpression(source),
735-
filters,
749+
filters: sqlFilters,
736750
variables: tileVariables,
737751
metricTables: isMetricSource ? source.metricTables : undefined,
738752
});
739753
}
740754
}
741-
}, [source, chart, dateRange, granularity, filters, tileVariables]);
755+
}, [
756+
source,
757+
chart,
758+
dateRange,
759+
granularity,
760+
sqlFilters,
761+
promqlFilters,
762+
tileVariables,
763+
]);
742764

743765
const [hovered, setHovered] = useState(false);
744766

@@ -809,7 +831,7 @@ const Tile = ({
809831
where: builderConfig?.where,
810832
whereLanguage: builderConfig?.whereLanguage,
811833
select: builderConfig?.select,
812-
filters,
834+
filters: sqlFilters,
813835
},
814836
);
815837

@@ -819,10 +841,10 @@ const Tile = ({
819841
);
820842

821843
const filterWarning = useMemo(() => {
822-
const doFiltersExist = !!filters?.filter(
844+
const doFiltersExist = !!sqlFilters?.filter(
823845
f => (f.type === 'lucene' || f.type === 'sql') && f.condition.trim(),
824846
)?.length;
825-
const doLuceneFiltersExist = !!filters?.filter(
847+
const doLuceneFiltersExist = !!sqlFilters?.filter(
826848
f => f.type === 'lucene' && f.condition.trim(),
827849
)?.length;
828850

@@ -858,7 +880,7 @@ const Tile = ({
858880
<IconZoomExclamation size={16} color="var(--color-text-danger)" />
859881
</Tooltip>
860882
);
861-
}, [filters, queriedConfig, source]);
883+
}, [sqlFilters, queriedConfig, source]);
862884

863885
const replaySearchUrl = useMemo(() => {
864886
return buildDashboardReplaySearchUrl({
@@ -1548,7 +1570,7 @@ const EditTileModal = ({
15481570
isSaving?: boolean;
15491571
onSave: (chart: Tile) => void;
15501572
variables?: ChartVariable[];
1551-
getDashboardFilters: (sourceId: string | undefined) => Filter[];
1573+
getDashboardFilters: (sourceId: string | undefined) => BroadcastFilter[];
15521574
unsatisfiedRequiredFilters?: DashboardFilter[];
15531575
}) => {
15541576
const contextZIndex = useZIndex();
@@ -2304,7 +2326,7 @@ function DBDashboardPage({
23042326
// `sourceId`. Shared with the tile editor so its preview queries what the
23052327
// tile does.
23062328
const getTileFilters = useCallback(
2307-
(sourceId: string | undefined): Filter[] => [
2329+
(sourceId: string | undefined): BroadcastFilter[] => [
23082330
{
23092331
type: whereLanguage === 'sql' ? 'sql' : 'lucene',
23102332
condition: where,

‎packages/app/src/DBServiceMapPage.tsx‎

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import { IS_LOCAL_MODE } from '@/config';
3838
import { useGetKeyValues } from '@/hooks/useMetadata';
3939
import { useResolvedSourceParam } from '@/hooks/useResolvedSourceParam';
4040
import { withAppNavForSurface } from '@/layout';
41+
import { useLocalStorage } from '@/utils';
4142
import { parseAsStringEncoded } from '@/utils/queryParsers';
4243

4344
import OnboardingModal from './components/OnboardingModal';
@@ -76,6 +77,9 @@ const SAMPLING_FACTORS = [
7677
},
7778
];
7879

80+
const DEFAULT_SAMPLING_FACTOR = 10;
81+
const SAMPLING_FACTOR_STORAGE_KEY = 'hdx-service-map-sampling-factor';
82+
7983
const DEFAULT_INTERVAL = 'Past 1h';
8084

8185
const searchQueryStateMap = {
@@ -210,9 +214,28 @@ function DBServiceMapPage() {
210214
})();
211215
}, [handleSubmit, setSearchedConfig, displayedTimeInputValue, onSearch]);
212216

213-
const [samplingFactor, setSamplingFactor] = useQueryState(
217+
// The URL param wins so shared links reproduce the sender's view, but only
218+
// slider changes are remembered: opening a link must not overwrite the
219+
// viewer's saved preference.
220+
const [samplingFactorParam, setSamplingFactorParam] = useQueryState(
214221
'samplingFactor',
215-
parseAsInteger.withDefault(10),
222+
parseAsInteger,
223+
);
224+
const [storedSamplingFactor, setStoredSamplingFactor] = useLocalStorage(
225+
SAMPLING_FACTOR_STORAGE_KEY,
226+
DEFAULT_SAMPLING_FACTOR,
227+
);
228+
const samplingFactor =
229+
samplingFactorParam ??
230+
(SAMPLING_FACTORS.some(factor => factor.value === storedSamplingFactor)
231+
? storedSamplingFactor
232+
: DEFAULT_SAMPLING_FACTOR);
233+
const setSamplingFactor = useCallback(
234+
(value: number) => {
235+
setStoredSamplingFactor(value);
236+
setSamplingFactorParam(value);
237+
},
238+
[setStoredSamplingFactor, setSamplingFactorParam],
216239
);
217240
const { label: samplingLabel = '' } =
218241
SAMPLING_FACTORS.find(factor => factor.value === samplingFactor) ?? {};
@@ -253,7 +276,7 @@ function DBServiceMapPage() {
253276

254277
const headerActions = (
255278
<Group gap="sm" wrap="nowrap">
256-
<Text bg="inherit" size="sm">
279+
<Text bg="inherit" size="sm" data-testid="service-map-sampling-label">
257280
Sampling {samplingLabel}
258281
</Text>
259282
<div style={{ minWidth: '200px' }}>
@@ -266,6 +289,7 @@ function DBServiceMapPage() {
266289
)}
267290
onChange={v => setSamplingFactor(SAMPLING_FACTORS[v].value)}
268291
showLabelOnHover={false}
292+
data-testid="service-map-sampling-slider"
269293
/>
270294
</div>
271295
<TimePicker

‎packages/app/src/HDXMultiSeriesTableChart.module.scss‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
// .rowButtons pattern from LogTable.module.scss (lines 156-172),
55
// scoped down to a single icon. See HDX-4405.
66

7+
.tableWrapper {
8+
font-size: var(--hdx-content-font-size);
9+
}
10+
711
.tableHeader {
812
// Always-on 1px separator between the sticky header and the rows. An
913
// inset box-shadow rather than a border because the table sets

‎packages/app/src/HDXMultiSeriesTableChart.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ export const Table = ({
408408

409409
return (
410410
<div
411-
className={cx('overflow-auto h-100 fs-8', className)}
411+
className={cx('overflow-auto h-100', styles.tableWrapper, className)}
412412
ref={tableContainerRef}
413413
>
414414
<table

0 commit comments

Comments
 (0)