@parca/profile 0.19.121 → 0.19.123

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/GraphTooltipArrow/Content.js +1 -1
  3. package/dist/MetricsGraph/useMetricsGraphDimensions.d.ts.map +1 -1
  4. package/dist/MetricsGraph/useMetricsGraphDimensions.js +5 -3
  5. package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +1 -1
  6. package/dist/ProfileFlameChart/index.d.ts.map +1 -1
  7. package/dist/ProfileFlameChart/index.js +11 -1
  8. package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.d.ts +20 -0
  9. package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.d.ts.map +1 -0
  10. package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +173 -0
  11. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts +11 -0
  12. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -0
  13. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +10 -0
  14. package/dist/ProfileFlameGraph/FlameGraphArrow/index.d.ts +1 -0
  15. package/dist/ProfileFlameGraph/FlameGraphArrow/index.d.ts.map +1 -1
  16. package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +19 -8
  17. package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.d.ts +9 -0
  18. package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.d.ts.map +1 -0
  19. package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +88 -0
  20. package/dist/ProfileFlameGraph/index.d.ts +2 -1
  21. package/dist/ProfileFlameGraph/index.d.ts.map +1 -1
  22. package/dist/ProfileFlameGraph/index.js +4 -6
  23. package/dist/ProfileMetricsGraph/index.d.ts.map +1 -1
  24. package/dist/ProfileMetricsGraph/index.js +2 -1
  25. package/dist/ProfileSelector/MetricsGraphSection.d.ts +1 -2
  26. package/dist/ProfileSelector/MetricsGraphSection.d.ts.map +1 -1
  27. package/dist/ProfileSelector/MetricsGraphSection.js +4 -1
  28. package/dist/ProfileSelector/index.d.ts.map +1 -1
  29. package/dist/ProfileSelector/index.js +8 -3
  30. package/dist/TimelineGuide/index.js +1 -1
  31. package/dist/styles.css +1 -1
  32. package/package.json +3 -3
  33. package/src/GraphTooltipArrow/Content.tsx +1 -1
  34. package/src/MetricsGraph/useMetricsGraphDimensions.ts +7 -5
  35. package/src/ProfileFlameChart/SamplesStrips/SamplesGraph/index.tsx +1 -1
  36. package/src/ProfileFlameChart/index.tsx +23 -0
  37. package/src/ProfileFlameGraph/FlameGraphArrow/MiniMap.tsx +270 -0
  38. package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +67 -0
  39. package/src/ProfileFlameGraph/FlameGraphArrow/index.tsx +97 -38
  40. package/src/ProfileFlameGraph/FlameGraphArrow/useZoom.ts +116 -0
  41. package/src/ProfileFlameGraph/index.tsx +6 -14
  42. package/src/ProfileMetricsGraph/index.tsx +5 -1
  43. package/src/ProfileSelector/MetricsGraphSection.tsx +3 -2
  44. package/src/ProfileSelector/index.tsx +7 -3
  45. package/src/TimelineGuide/index.tsx +2 -2
@@ -33,9 +33,8 @@ import DiffLegend from '../ProfileView/components/DiffLegend';
33
33
  import {useProfileViewContext} from '../ProfileView/context/ProfileViewContext';
34
34
  import {useProfileMetadata} from '../ProfileView/hooks/useProfileMetadata';
35
35
  import {useVisualizationState} from '../ProfileView/hooks/useVisualizationState';
36
- import {TimelineGuide} from '../TimelineGuide';
37
36
  import {FlameGraphArrow} from './FlameGraphArrow';
38
- import {CurrentPathFrame, boundsFromProfileSource} from './FlameGraphArrow/utils';
37
+ import {CurrentPathFrame} from './FlameGraphArrow/utils';
39
38
 
40
39
  const numberFormatter = new Intl.NumberFormat('en-US');
41
40
 
@@ -62,6 +61,7 @@ interface ProfileFlameGraphProps {
62
61
  tooltipId?: string;
63
62
  maxFrameCount?: number;
64
63
  isExpanded?: boolean;
64
+ zoomControlsRef?: React.RefObject<HTMLDivElement | null>;
65
65
  }
66
66
 
67
67
  const ErrorContent = ({errorMessage}: {errorMessage: string | ReactNode}): JSX.Element => {
@@ -101,11 +101,12 @@ const ProfileFlameGraph = function ProfileFlameGraphNonMemo({
101
101
  maxFrameCount,
102
102
  isExpanded = false,
103
103
  metadataLoading = false,
104
+ zoomControlsRef,
104
105
  }: ProfileFlameGraphProps): JSX.Element {
105
106
  const {onError, authenticationErrorMessage, isDarkMode, flamechartHelpText} = useParcaContext();
106
107
  const {compareMode} = useProfileViewContext();
107
108
  const [isLoading, setIsLoading] = useState<boolean>(true);
108
- const [flameChartRef, {height: flameChartHeight}] = useMeasure();
109
+ const [flameChartRef] = useMeasure();
109
110
  const {colorBy, setColorBy} = useVisualizationState();
110
111
 
111
112
  // Create local state for paths when in sandwich view to avoid URL updates
@@ -263,16 +264,6 @@ const ProfileFlameGraph = function ProfileFlameGraphNonMemo({
263
264
  if (arrow !== undefined) {
264
265
  return (
265
266
  <div className="relative">
266
- {isFlameChart ? (
267
- <TimelineGuide
268
- bounds={boundsFromProfileSource(profileSource)}
269
- width={width}
270
- height={flameChartHeight ?? 420}
271
- margin={0}
272
- ticks={12}
273
- timeUnit="nanoseconds"
274
- />
275
- ) : null}
276
267
  <div ref={flameChartRef as LegacyRef<HTMLDivElement>}>
277
268
  <FlameGraphArrow
278
269
  width={width}
@@ -294,6 +285,7 @@ const ProfileFlameGraph = function ProfileFlameGraphNonMemo({
294
285
  maxFrameCount={maxFrameCount}
295
286
  isExpanded={isExpanded}
296
287
  colorBy={colorBy}
288
+ zoomControlsRef={zoomControlsRef}
297
289
  />
298
290
  </div>
299
291
  </div>
@@ -312,7 +304,6 @@ const ProfileFlameGraph = function ProfileFlameGraphNonMemo({
312
304
  isCompareAbsolute,
313
305
  isFlameChart,
314
306
  profileSource,
315
- flameChartHeight,
316
307
  flameChartRef,
317
308
  flamechartHelpText,
318
309
  isRenderedAsFlamegraph,
@@ -325,6 +316,7 @@ const ProfileFlameGraph = function ProfileFlameGraphNonMemo({
325
316
  mappingsList,
326
317
  filenamesList,
327
318
  colorBy,
319
+ zoomControlsRef,
328
320
  ]);
329
321
 
330
322
  useEffect(() => {
@@ -225,7 +225,11 @@ const ProfileMetricsGraph = ({
225
225
  queryExpression === ''
226
226
  );
227
227
  const {onError, perf, authenticationErrorMessage, isDarkMode, timezone} = useParcaContext();
228
- const {width, height, margin, heightStyle} = useMetricsGraphDimensions(comparing);
228
+ const isGpuProfileType = queryExpression.includes(':cuda:');
229
+ const {width, height, margin, heightStyle} = useMetricsGraphDimensions(
230
+ comparing,
231
+ isGpuProfileType
232
+ );
229
233
  const [showAllSeriesForResponse, setShowAllSeriesForResponse] = useState<typeof response | null>(
230
234
  null
231
235
  );
@@ -18,6 +18,7 @@ import {DateTimeRange, useURLStateBatch} from '@parca/components';
18
18
  import {Query} from '@parca/parser';
19
19
 
20
20
  import {ProfileSelection} from '..';
21
+ import {useMetricsGraphDimensions} from '../MetricsGraph/useMetricsGraphDimensions';
21
22
  import ProfileMetricsGraph, {ProfileMetricsEmptyState} from '../ProfileMetricsGraph';
22
23
  import {useResetStateOnSeriesChange} from '../ProfileView/hooks/useResetStateOnSeriesChange';
23
24
  import {QuerySelection} from './index';
@@ -25,7 +26,6 @@ import {QuerySelection} from './index';
25
26
  interface MetricsGraphSectionProps {
26
27
  showMetricsGraph: boolean;
27
28
  setDisplayHideMetricsGraphButton?: (show: boolean) => void;
28
- heightStyle: string;
29
29
  querySelection: QuerySelection;
30
30
  profileSelection: ProfileSelection | null;
31
31
  comparing: boolean;
@@ -50,7 +50,6 @@ interface MetricsGraphSectionProps {
50
50
  export function MetricsGraphSection({
51
51
  showMetricsGraph,
52
52
  setDisplayHideMetricsGraphButton,
53
- heightStyle,
54
53
  querySelection,
55
54
  profileSelection,
56
55
  comparing,
@@ -69,6 +68,8 @@ export function MetricsGraphSection({
69
68
  }: MetricsGraphSectionProps): JSX.Element {
70
69
  const resetStateOnSeriesChange = useResetStateOnSeriesChange();
71
70
  const batchUpdates = useURLStateBatch();
71
+ const isGpuProfileType = querySelection.expression.includes(':cuda:');
72
+ const {heightStyle} = useMetricsGraphDimensions(comparing, isGpuProfileType);
72
73
  const handleTimeRangeChange = (range: DateTimeRange): void => {
73
74
  const from = range.getFromMs();
74
75
  const to = range.getToMs();
@@ -29,7 +29,6 @@ import {Query} from '@parca/parser';
29
29
  import {TEST_IDS, testId} from '@parca/test-utils';
30
30
  import {millisToProtoTimestamp, type NavigateFunction} from '@parca/utilities';
31
31
 
32
- import {useMetricsGraphDimensions} from '../MetricsGraph/useMetricsGraphDimensions';
33
32
  import {
34
33
  ProfileFilter,
35
34
  useProfileFilters,
@@ -118,7 +117,6 @@ const ProfileSelector = ({
118
117
  suffix,
119
118
  onSearchHook,
120
119
  }: ProfileSelectorProps): JSX.Element => {
121
- const {heightStyle} = useMetricsGraphDimensions(comparing, false);
122
120
  const {viewComponent, additionalMetricsGraph} = useParcaContext();
123
121
  const [queryBrowserMode, setQueryBrowserMode] = useURLState('query_browser_mode');
124
122
  const batchUpdates = useURLStateBatch();
@@ -298,6 +296,13 @@ const ProfileSelector = ({
298
296
  timeRange: timeRangeSelection,
299
297
  onTimeRangeChange: handleTimeRangeChange,
300
298
  commitTimeRange: () => setQueryExpression(true),
299
+ selectTimeRange: (range: DateTimeRange) => {
300
+ commitDraft({
301
+ from: range.getFromMs(),
302
+ to: range.getToMs(),
303
+ timeSelection: range.getRangeKey(),
304
+ });
305
+ },
301
306
  })}
302
307
  <LabelsQueryProvider
303
308
  setMatchersString={setMatchersString}
@@ -356,7 +361,6 @@ const ProfileSelector = ({
356
361
  <MetricsGraphSection
357
362
  showMetricsGraph={showMetricsGraph}
358
363
  setDisplayHideMetricsGraphButton={setDisplayHideMetricsGraphButton}
359
- heightStyle={heightStyle}
360
364
  querySelection={querySelection}
361
365
  profileSelection={profileSelection}
362
366
  comparing={comparing}
@@ -49,8 +49,8 @@ export const TimelineGuide = ({
49
49
 
50
50
  return (
51
51
  <div className="relative h-5">
52
- <div className="absolute" style={{width, height}}>
53
- <svg style={{width: '100%', height: '100%'}} className="z-[5]">
52
+ <div className="pointer-events-none absolute" style={{width, height}}>
53
+ <svg style={{width: '100%', height: '100%'}}>
54
54
  <g
55
55
  className="x axis"
56
56
  fill="none"