@parca/profile 0.19.113 → 0.19.115
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.
- package/CHANGELOG.md +8 -0
- package/dist/ProfileExplorer/ProfileExplorerSingle.d.ts.map +1 -1
- package/dist/ProfileExplorer/ProfileExplorerSingle.js +9 -3
- package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.d.ts +31 -0
- package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.d.ts.map +1 -0
- package/dist/{MetricsGraphStrips/AreaGraph → ProfileFlameChart/SamplesStrips/SamplesGraph}/index.js +32 -60
- package/dist/{MetricsGraphStrips/MetricsGraphStrips.stories.d.ts → ProfileFlameChart/SamplesStrips/SamplesStrips.stories.d.ts} +4 -3
- package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.d.ts.map +1 -0
- package/dist/{MetricsGraphStrips/MetricsGraphStrips.stories.js → ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js} +5 -4
- package/dist/{MetricsGraphStrips → ProfileFlameChart/SamplesStrips}/index.d.ts +5 -4
- package/dist/ProfileFlameChart/SamplesStrips/index.d.ts.map +1 -0
- package/dist/ProfileFlameChart/SamplesStrips/index.js +145 -0
- package/dist/ProfileFlameChart/index.d.ts +20 -0
- package/dist/ProfileFlameChart/index.d.ts.map +1 -0
- package/dist/ProfileFlameChart/index.js +155 -0
- package/dist/ProfileFlameGraph/index.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/index.js +0 -1
- package/dist/ProfileMetricsGraph/hooks/useQueryRange.d.ts +2 -1
- package/dist/ProfileMetricsGraph/hooks/useQueryRange.d.ts.map +1 -1
- package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +11 -21
- package/dist/ProfileMetricsGraph/index.d.ts.map +1 -1
- package/dist/ProfileMetricsGraph/index.js +13 -3
- package/dist/ProfileSelector/index.d.ts.map +1 -1
- package/dist/ProfileSelector/index.js +4 -0
- package/dist/ProfileView/components/ActionButtons/GroupByDropdown.d.ts +1 -0
- package/dist/ProfileView/components/ActionButtons/GroupByDropdown.d.ts.map +1 -1
- package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +2 -2
- package/dist/ProfileView/components/DashboardItems/index.d.ts +5 -4
- package/dist/ProfileView/components/DashboardItems/index.d.ts.map +1 -1
- package/dist/ProfileView/components/DashboardItems/index.js +4 -3
- package/dist/ProfileView/components/GroupByLabelsDropdown/index.d.ts +2 -1
- package/dist/ProfileView/components/GroupByLabelsDropdown/index.d.ts.map +1 -1
- package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +2 -2
- package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +1 -1
- package/dist/ProfileView/components/Toolbars/index.d.ts +2 -0
- package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/index.js +4 -2
- package/dist/ProfileView/hooks/useAutoSelectDimension.d.ts +16 -0
- package/dist/ProfileView/hooks/useAutoSelectDimension.d.ts.map +1 -0
- package/dist/ProfileView/hooks/useAutoSelectDimension.js +75 -0
- package/dist/ProfileView/hooks/useVisualizationState.d.ts +2 -0
- package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useVisualizationState.js +8 -0
- package/dist/ProfileView/index.d.ts +1 -1
- package/dist/ProfileView/index.d.ts.map +1 -1
- package/dist/ProfileView/index.js +7 -4
- package/dist/ProfileView/types/visualization.d.ts +15 -3
- package/dist/ProfileView/types/visualization.d.ts.map +1 -1
- package/dist/ProfileViewWithData.d.ts +2 -1
- package/dist/ProfileViewWithData.d.ts.map +1 -1
- package/dist/ProfileViewWithData.js +41 -29
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/styles.css +1 -1
- package/package.json +8 -7
- package/src/ProfileExplorer/ProfileExplorerSingle.tsx +14 -3
- package/src/{MetricsGraphStrips/AreaGraph → ProfileFlameChart/SamplesStrips/SamplesGraph}/index.tsx +77 -81
- package/src/{MetricsGraphStrips/MetricsGraphStrips.stories.tsx → ProfileFlameChart/SamplesStrips/SamplesStrips.stories.tsx} +7 -6
- package/src/ProfileFlameChart/SamplesStrips/index.tsx +317 -0
- package/src/ProfileFlameChart/index.tsx +305 -0
- package/src/ProfileFlameGraph/index.tsx +0 -1
- package/src/ProfileMetricsGraph/hooks/useQueryRange.ts +18 -26
- package/src/ProfileMetricsGraph/index.tsx +24 -2
- package/src/ProfileSelector/index.tsx +11 -0
- package/src/ProfileView/components/ActionButtons/GroupByDropdown.tsx +3 -0
- package/src/ProfileView/components/DashboardItems/index.tsx +19 -17
- package/src/ProfileView/components/GroupByLabelsDropdown/index.tsx +4 -2
- package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +1 -1
- package/src/ProfileView/components/Toolbars/index.tsx +18 -1
- package/src/ProfileView/hooks/useAutoSelectDimension.ts +90 -0
- package/src/ProfileView/hooks/useVisualizationState.ts +17 -0
- package/src/ProfileView/index.tsx +16 -2
- package/src/ProfileView/types/visualization.ts +17 -3
- package/src/ProfileViewWithData.tsx +80 -37
- package/src/index.tsx +4 -0
- package/dist/MetricsGraphStrips/AreaGraph/Tooltip.d.ts +0 -10
- package/dist/MetricsGraphStrips/AreaGraph/Tooltip.d.ts.map +0 -1
- package/dist/MetricsGraphStrips/AreaGraph/Tooltip.js +0 -44
- package/dist/MetricsGraphStrips/AreaGraph/index.d.ts +0 -21
- package/dist/MetricsGraphStrips/AreaGraph/index.d.ts.map +0 -1
- package/dist/MetricsGraphStrips/MetricsGraphStrips.stories.d.ts.map +0 -1
- package/dist/MetricsGraphStrips/index.d.ts.map +0 -1
- package/dist/MetricsGraphStrips/index.js +0 -70
- package/src/MetricsGraphStrips/AreaGraph/Tooltip.tsx +0 -83
- package/src/MetricsGraphStrips/index.tsx +0 -142
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// Copyright 2022 The Parca Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
|
|
14
|
-
import {useEffect, useRef, useState} from 'react';
|
|
15
|
-
|
|
16
|
-
import {useParcaContext} from '@parca/components';
|
|
17
|
-
import {formatDateTimeDownToMS, valueFormatter} from '@parca/utilities';
|
|
18
|
-
|
|
19
|
-
interface TooltipProps {
|
|
20
|
-
x: number;
|
|
21
|
-
y: number;
|
|
22
|
-
timestamp: Date | number;
|
|
23
|
-
value: number;
|
|
24
|
-
containerWidth: number;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function Tooltip({x, y, timestamp, value, containerWidth}: TooltipProps): JSX.Element {
|
|
28
|
-
const {timezone} = useParcaContext();
|
|
29
|
-
const tooltipRef = useRef<HTMLDivElement>(null);
|
|
30
|
-
const [tooltipPosition, setTooltipPosition] = useState({x, y});
|
|
31
|
-
|
|
32
|
-
const baseOffset = {
|
|
33
|
-
x: 16,
|
|
34
|
-
y: -8,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (tooltipRef.current != null) {
|
|
39
|
-
const tooltipWidth = tooltipRef.current.offsetWidth;
|
|
40
|
-
|
|
41
|
-
let newX = x + baseOffset.x;
|
|
42
|
-
let newY = y + baseOffset.y;
|
|
43
|
-
|
|
44
|
-
if (newX + tooltipWidth > containerWidth) {
|
|
45
|
-
newX = x - tooltipWidth - baseOffset.x;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (newY < 0) {
|
|
49
|
-
newY = y + Math.abs(baseOffset.y);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
setTooltipPosition({x: newX, y: newY});
|
|
53
|
-
}
|
|
54
|
-
}, [x, y, containerWidth, baseOffset.x, baseOffset.y]);
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<div
|
|
58
|
-
ref={tooltipRef}
|
|
59
|
-
className="absolute bg-white dark:bg-gray-800 rounded-md shadow-lg border border-gray-200 dark:border-gray-700 p-2 text-sm z-50"
|
|
60
|
-
style={{
|
|
61
|
-
left: `${tooltipPosition.x}px`,
|
|
62
|
-
top: `${tooltipPosition.y}px`,
|
|
63
|
-
pointerEvents: 'none',
|
|
64
|
-
}}
|
|
65
|
-
>
|
|
66
|
-
<div className="flex flex-col gap-1">
|
|
67
|
-
<div className="flex gap-1 items-center">
|
|
68
|
-
<div>Timestamp:</div>
|
|
69
|
-
<div className="text-gray-600 dark:text-gray-300">
|
|
70
|
-
{formatDateTimeDownToMS(timestamp, timezone)}
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
|
|
74
|
-
<div className="flex gap-1 items-center">
|
|
75
|
-
<div>Value:</div>
|
|
76
|
-
<div className="text-gray-600 dark:text-gray-300">
|
|
77
|
-
{valueFormatter(value, 'nanoseconds', 2)}
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
// Copyright 2022 The Parca Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
|
|
14
|
-
import {useState} from 'react';
|
|
15
|
-
|
|
16
|
-
import {Icon} from '@iconify/react';
|
|
17
|
-
import cx from 'classnames';
|
|
18
|
-
import * as d3 from 'd3';
|
|
19
|
-
import isEqual from 'fast-deep-equal';
|
|
20
|
-
|
|
21
|
-
import {LabelSet} from '@parca/client';
|
|
22
|
-
|
|
23
|
-
import {TimelineGuide} from '../TimelineGuide';
|
|
24
|
-
import {NumberDuo} from '../utils';
|
|
25
|
-
import {AreaGraph, DataPoint} from './AreaGraph';
|
|
26
|
-
|
|
27
|
-
interface Props {
|
|
28
|
-
cpus: LabelSet[];
|
|
29
|
-
data: DataPoint[][];
|
|
30
|
-
selectedTimeframe?: {
|
|
31
|
-
labels: LabelSet;
|
|
32
|
-
bounds: NumberDuo;
|
|
33
|
-
};
|
|
34
|
-
onSelectedTimeframe: (labels: LabelSet, bounds: NumberDuo | undefined) => void;
|
|
35
|
-
width?: number;
|
|
36
|
-
bounds: NumberDuo;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const labelSetToString = (labelSet?: LabelSet): string => {
|
|
40
|
-
if (labelSet === undefined) {
|
|
41
|
-
return '{}';
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
let str = '{';
|
|
45
|
-
|
|
46
|
-
let isFirst = true;
|
|
47
|
-
for (const label of labelSet.labels) {
|
|
48
|
-
if (!isFirst) {
|
|
49
|
-
str += ', ';
|
|
50
|
-
isFirst = false;
|
|
51
|
-
}
|
|
52
|
-
str += `${label.name}: ${label.value}`;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
str += '}';
|
|
56
|
-
|
|
57
|
-
return str;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const STRIP_HEIGHT = 24;
|
|
61
|
-
|
|
62
|
-
const getTimelineGuideHeight = (cpus: LabelSet[], collapsedIndices: number[]): number => {
|
|
63
|
-
return (
|
|
64
|
-
(STRIP_HEIGHT + 4) * (cpus.length - collapsedIndices.length) +
|
|
65
|
-
20 * collapsedIndices.length +
|
|
66
|
-
24 -
|
|
67
|
-
6
|
|
68
|
-
);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const MetricsGraphStrips = ({
|
|
72
|
-
cpus,
|
|
73
|
-
data,
|
|
74
|
-
selectedTimeframe,
|
|
75
|
-
onSelectedTimeframe,
|
|
76
|
-
width,
|
|
77
|
-
bounds,
|
|
78
|
-
}: Props): JSX.Element => {
|
|
79
|
-
const [collapsedIndices, setCollapsedIndices] = useState<number[]>([]);
|
|
80
|
-
|
|
81
|
-
const color = d3.scaleOrdinal(d3.schemeObservable10);
|
|
82
|
-
|
|
83
|
-
const valueBounds = d3.extent(data.flatMap(d => d.map(p => p.value))) as [number, number];
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<div className="flex flex-col gap-1 relative my-0 ml-[70px]" style={{width: width ?? '100%'}}>
|
|
87
|
-
<TimelineGuide
|
|
88
|
-
bounds={[BigInt(0), BigInt(bounds[1] - bounds[0])]}
|
|
89
|
-
width={width ?? 1468}
|
|
90
|
-
height={getTimelineGuideHeight(cpus, collapsedIndices)}
|
|
91
|
-
margin={1}
|
|
92
|
-
/>
|
|
93
|
-
{cpus.map((cpu, i) => {
|
|
94
|
-
const isCollapsed = collapsedIndices.includes(i);
|
|
95
|
-
const isSelected = isEqual(cpu, selectedTimeframe?.labels);
|
|
96
|
-
const labelStr = labelSetToString(cpu);
|
|
97
|
-
return (
|
|
98
|
-
<div
|
|
99
|
-
className={cx('min-h-5', {
|
|
100
|
-
relative: !isSelected,
|
|
101
|
-
'sticky z-30 bg-white dark:bg-black bg-opacity-75': isSelected,
|
|
102
|
-
})}
|
|
103
|
-
style={{width: width ?? 1468, top: isSelected ? 302 : undefined}}
|
|
104
|
-
key={labelStr}
|
|
105
|
-
>
|
|
106
|
-
<div
|
|
107
|
-
className="text-xs absolute top-0 left-0 flex gap-[2px] items-center bg-white/50 dark:bg-black/50 px-1 rounded-sm cursor-pointer"
|
|
108
|
-
style={{
|
|
109
|
-
zIndex: 15,
|
|
110
|
-
}}
|
|
111
|
-
onClick={() => {
|
|
112
|
-
const newCollapsedIndices = [...collapsedIndices];
|
|
113
|
-
if (collapsedIndices.includes(i)) {
|
|
114
|
-
newCollapsedIndices.splice(newCollapsedIndices.indexOf(i), 1);
|
|
115
|
-
} else {
|
|
116
|
-
newCollapsedIndices.push(i);
|
|
117
|
-
}
|
|
118
|
-
setCollapsedIndices(newCollapsedIndices);
|
|
119
|
-
}}
|
|
120
|
-
>
|
|
121
|
-
<Icon icon={isCollapsed ? 'bxs:right-arrow' : 'bxs:down-arrow'} />
|
|
122
|
-
{labelStr}
|
|
123
|
-
</div>
|
|
124
|
-
{!isCollapsed ? (
|
|
125
|
-
<AreaGraph
|
|
126
|
-
data={data[i]}
|
|
127
|
-
height={STRIP_HEIGHT}
|
|
128
|
-
width={width ?? 1468}
|
|
129
|
-
fill={color(labelStr)}
|
|
130
|
-
selectionBounds={isSelected ? selectedTimeframe?.bounds : undefined}
|
|
131
|
-
setSelectionBounds={bounds => {
|
|
132
|
-
onSelectedTimeframe(cpu, bounds);
|
|
133
|
-
}}
|
|
134
|
-
valueBounds={valueBounds}
|
|
135
|
-
/>
|
|
136
|
-
) : null}
|
|
137
|
-
</div>
|
|
138
|
-
);
|
|
139
|
-
})}
|
|
140
|
-
</div>
|
|
141
|
-
);
|
|
142
|
-
};
|