@parca/profile 0.19.44 → 0.19.45

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 (47) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/GraphTooltipArrow/Content.d.ts.map +1 -1
  3. package/dist/GraphTooltipArrow/Content.js +1 -1
  4. package/dist/MetricsGraph/MetricsContextMenu/index.d.ts +20 -11
  5. package/dist/MetricsGraph/MetricsContextMenu/index.d.ts.map +1 -1
  6. package/dist/MetricsGraph/MetricsContextMenu/index.js +16 -20
  7. package/dist/MetricsGraph/MetricsTooltip/index.d.ts +2 -8
  8. package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
  9. package/dist/MetricsGraph/MetricsTooltip/index.js +46 -55
  10. package/dist/MetricsGraph/UtilizationMetrics/Throughput.d.ts +2 -5
  11. package/dist/MetricsGraph/UtilizationMetrics/Throughput.d.ts.map +1 -1
  12. package/dist/MetricsGraph/UtilizationMetrics/Throughput.js +126 -205
  13. package/dist/MetricsGraph/UtilizationMetrics/index.d.ts +9 -17
  14. package/dist/MetricsGraph/UtilizationMetrics/index.d.ts.map +1 -1
  15. package/dist/MetricsGraph/UtilizationMetrics/index.js +149 -208
  16. package/dist/MetricsGraph/index.d.ts +19 -26
  17. package/dist/MetricsGraph/index.d.ts.map +1 -1
  18. package/dist/MetricsGraph/index.js +50 -115
  19. package/dist/ProfileFlameGraph/index.d.ts.map +1 -1
  20. package/dist/ProfileFlameGraph/index.js +3 -1
  21. package/dist/ProfileMetricsGraph/index.d.ts +1 -1
  22. package/dist/ProfileMetricsGraph/index.d.ts.map +1 -1
  23. package/dist/ProfileMetricsGraph/index.js +232 -23
  24. package/dist/ProfileSelector/MetricsGraphSection.d.ts +1 -4
  25. package/dist/ProfileSelector/MetricsGraphSection.d.ts.map +1 -1
  26. package/dist/ProfileSelector/MetricsGraphSection.js +8 -4
  27. package/dist/ProfileSelector/index.d.ts +3 -6
  28. package/dist/ProfileSelector/index.d.ts.map +1 -1
  29. package/dist/ProfileSelector/index.js +2 -2
  30. package/dist/ProfileSource.d.ts +9 -6
  31. package/dist/ProfileSource.d.ts.map +1 -1
  32. package/dist/ProfileSource.js +23 -8
  33. package/dist/styles.css +1 -1
  34. package/dist/useQuery.js +1 -1
  35. package/package.json +6 -6
  36. package/src/GraphTooltipArrow/Content.tsx +2 -4
  37. package/src/MetricsGraph/MetricsContextMenu/index.tsx +78 -66
  38. package/src/MetricsGraph/MetricsTooltip/index.tsx +53 -210
  39. package/src/MetricsGraph/UtilizationMetrics/Throughput.tsx +242 -434
  40. package/src/MetricsGraph/UtilizationMetrics/index.tsx +312 -448
  41. package/src/MetricsGraph/index.tsx +99 -185
  42. package/src/ProfileFlameGraph/index.tsx +3 -1
  43. package/src/ProfileMetricsGraph/index.tsx +430 -37
  44. package/src/ProfileSelector/MetricsGraphSection.tsx +12 -8
  45. package/src/ProfileSelector/index.tsx +5 -5
  46. package/src/ProfileSource.tsx +34 -17
  47. package/src/useQuery.tsx +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.19.45](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.44...@parca/profile@0.19.45) (2025-08-28)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
6
10
  ## [0.19.44](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.43...@parca/profile@0.19.44) (2025-08-26)
7
11
 
8
12
  **Note:** Version bump only for package @parca/profile
@@ -1 +1 @@
1
- {"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../src/GraphTooltipArrow/Content.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AAGnC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAQ1C,UAAU,6BAA6B;IACrC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAMD,QAAA,MAAM,wBAAwB,GAAI,sFAS/B,6BAA6B,KAAG,KAAK,CAAC,GAAG,CAAC,OA+E5C,CAAC;AAuFF,eAAe,wBAAwB,CAAC"}
1
+ {"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../src/GraphTooltipArrow/Content.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AAGnC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAQ1C,UAAU,6BAA6B;IACrC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAMD,QAAA,MAAM,wBAAwB,GAAI,sFAS/B,6BAA6B,KAAG,KAAK,CAAC,GAAG,CAAC,OA+E5C,CAAC;AAqFF,eAAe,wBAAwB,CAAC"}
@@ -35,6 +35,6 @@ const TooltipMetaInfo = ({ table, row }) => {
35
35
  const labels = labelPairs.map((l) => (_jsx("span", { className: "mr-3 inline-block rounded-lg bg-gray-200 px-2 py-1 text-xs font-bold text-gray-700 dark:bg-gray-700 dark:text-gray-400", children: `${l[0]}="${l[1]}"` }, l[0])));
36
36
  const isMappingBuildIDAvailable = mappingBuildID !== null && mappingBuildID !== '';
37
37
  const inlinedText = inlined === null ? 'merged' : inlined ? 'yes' : 'no';
38
- return (_jsxs(_Fragment, { children: [timestamp == null || timestamp === 0n ? (_jsx("div", { className: "pt-2" })) : (_jsxs("tr", { children: [_jsx("td", { className: "w-1/4 pt-2", children: "Timestamp" }), _jsx("td", { className: "w-3/4 pt-2 break-all", children: formatDateTimeDownToMS(new Date(Number(timestamp / 1000000n)), timezone) }), ' '] })), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "File" }), _jsx("td", { className: "w-3/4 break-all", children: functionFilename === '' ? (_jsx(NoData, {})) : (_jsx("div", { className: "flex gap-4", children: _jsx("div", { className: "whitespace-nowrap text-left", children: _jsx(ExpandOnHover, { value: file, displayValue: truncateStringReverse(file, 30) }) }) })) })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Address" }), _jsx("td", { className: "w-3/4 break-all", children: locationAddress === 0n ? _jsx(NoData, {}) : _jsx("div", { children: hexifyAddress(locationAddress) }) })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Inlined" }), _jsx("td", { className: "w-3/4 break-all", children: inlinedText })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Binary" }), _jsx("td", { className: "w-3/4 break-all", children: (mappingFile != null ? getLastItem(mappingFile) : null) ?? _jsx(NoData, {}) })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Build Id" }), _jsx("td", { className: "w-3/4 break-all", children: isMappingBuildIDAvailable ? _jsx("div", { children: truncateString(mappingBuildID, 28) }) : _jsx(NoData, {}) })] }), labelPairs.length > 0 && (_jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Labels" }), _jsx("td", { className: "w-3/4 break-all", children: labels })] }))] }));
38
+ return (_jsxs(_Fragment, { children: [timestamp != null && timestamp !== 0n && (_jsxs("tr", { children: [_jsx("td", { className: "w-1/4 pt-2", children: "Timestamp" }), _jsx("td", { className: "w-3/4 pt-2 break-all", children: formatDateTimeDownToMS(new Date(Number(timestamp / 1000000n)), timezone) })] })), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "File" }), _jsx("td", { className: "w-3/4 break-all", children: functionFilename === '' ? (_jsx(NoData, {})) : (_jsx("div", { className: "flex gap-4", children: _jsx("div", { className: "whitespace-nowrap text-left", children: _jsx(ExpandOnHover, { value: file, displayValue: truncateStringReverse(file, 30) }) }) })) })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Address" }), _jsx("td", { className: "w-3/4 break-all", children: locationAddress === 0n ? _jsx(NoData, {}) : _jsx("div", { children: hexifyAddress(locationAddress) }) })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Inlined" }), _jsx("td", { className: "w-3/4 break-all", children: inlinedText })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Binary" }), _jsx("td", { className: "w-3/4 break-all", children: (mappingFile != null ? getLastItem(mappingFile) : null) ?? _jsx(NoData, {}) })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Build Id" }), _jsx("td", { className: "w-3/4 break-all", children: isMappingBuildIDAvailable ? _jsx("div", { children: truncateString(mappingBuildID, 28) }) : _jsx(NoData, {}) })] }), labelPairs.length > 0 && (_jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Labels" }), _jsx("td", { className: "w-3/4 break-all", children: labels })] }))] }));
39
39
  };
40
40
  export default GraphTooltipArrowContent;
@@ -1,17 +1,26 @@
1
- import { HighlightedSeries } from '../';
1
+ import { Series, SeriesPoint } from '../';
2
+ export interface ContextMenuItem {
3
+ id: string;
4
+ label: React.ReactNode;
5
+ icon?: string;
6
+ onClick: (closestPoint: SeriesPoint | null, series: Series[]) => void;
7
+ disabled?: (closestPoint: SeriesPoint | null, series: Series[]) => boolean;
8
+ }
9
+ export interface ContextMenuSubmenu {
10
+ id: string;
11
+ label: React.ReactNode;
12
+ icon?: string;
13
+ items?: ContextMenuItem[];
14
+ createDynamicItems?: (closestPoint: SeriesPoint | null, series: Series[]) => ContextMenuItem[];
15
+ }
16
+ export type ContextMenuItemOrSubmenu = ContextMenuItem | ContextMenuSubmenu;
2
17
  interface MetricsContextMenuProps {
3
18
  menuId: string;
4
- onAddLabelMatcher: (labels: {
5
- key: string;
6
- value: string;
7
- } | Array<{
8
- key: string;
9
- value: string;
10
- }>) => void;
11
- highlighted: HighlightedSeries | null;
19
+ closestPoint: SeriesPoint | null;
20
+ series: Series[];
12
21
  trackVisibility: (isVisible: boolean) => void;
13
- utilizationMetrics?: boolean;
22
+ menuItems: ContextMenuItemOrSubmenu[];
14
23
  }
15
- declare const MetricsContextMenu: ({ menuId, onAddLabelMatcher, highlighted, trackVisibility, utilizationMetrics, }: MetricsContextMenuProps) => JSX.Element;
24
+ declare const MetricsContextMenu: ({ menuId, closestPoint, series, trackVisibility, menuItems, }: MetricsContextMenuProps) => JSX.Element;
16
25
  export default MetricsContextMenu;
17
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/MetricsGraph/MetricsContextMenu/index.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,iBAAiB,EAAC,MAAM,KAAK,CAAC;AAEtC,UAAU,uBAAuB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,CACjB,MAAM,EAAE;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAAG,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC,KACvE,IAAI,CAAC;IACV,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACtC,eAAe,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9C,kB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;CACvC;AAED,QAAA,MAAM,kBAAkB,GAAI,+DAMzB,uBAAuB,KAAG,GAAG,CAAC,OAgEhC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -14,27 +14,23 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { Icon } from '@iconify/react';
15
15
  import { Item, Menu, Submenu } from 'react-contexify';
16
16
  import { useParcaContext } from '@parca/components';
17
- const transformUtilizationLabels = (label, utilizationMetrics) => {
18
- if (utilizationMetrics) {
19
- return label.replace('attributes.', '').replace('attributes_resource.', '');
20
- }
21
- return label;
22
- };
23
- const MetricsContextMenu = ({ menuId, onAddLabelMatcher, highlighted, trackVisibility, utilizationMetrics = false, }) => {
17
+ const MetricsContextMenu = ({ menuId, closestPoint, series, trackVisibility, menuItems, }) => {
24
18
  const { isDarkMode } = useParcaContext();
25
- const labels = highlighted?.labels.filter((label) => label.name !== '__name__');
26
- const handleFocusOnSingleSeries = () => {
27
- const labelsToAdd = labels?.map((label) => ({
28
- key: label.name,
29
- value: label.value,
30
- }));
31
- labelsToAdd !== undefined && onAddLabelMatcher(labelsToAdd);
19
+ const renderMenuItem = (item) => {
20
+ if ('items' in item || 'createDynamicItems' in item) {
21
+ // This is a submenu
22
+ const submenu = item;
23
+ const items = submenu.createDynamicItems != null
24
+ ? submenu.createDynamicItems(closestPoint, series)
25
+ : submenu.items ?? [];
26
+ return (_jsx(Submenu, { label: _jsxs("div", { className: "flex w-full items-center gap-2", children: [submenu.icon != null && submenu.icon !== '' && _jsx(Icon, { icon: submenu.icon }), _jsx("div", { children: submenu.label })] }), children: _jsx("div", { className: "max-h-[300px] overflow-auto", children: items.map(subItem => (_jsx(Item, { id: subItem.id, onClick: () => subItem.onClick(closestPoint, series), disabled: subItem.disabled?.(closestPoint, series) ?? false, className: "max-w-[400px] overflow-hidden", children: _jsxs("div", { className: "flex w-full items-center gap-2", children: [subItem.icon != null && subItem.icon !== '' && _jsx(Icon, { icon: subItem.icon }), _jsx("div", { children: subItem.label })] }) }, subItem.id))) }) }, submenu.id));
27
+ }
28
+ else {
29
+ // This is a regular menu item
30
+ const menuItem = item;
31
+ return (_jsx(Item, { id: menuItem.id, onClick: () => menuItem.onClick(closestPoint, series), disabled: menuItem.disabled?.(closestPoint, series) ?? false, children: _jsxs("div", { className: "flex w-full items-center gap-2", children: [menuItem.icon != null && menuItem.icon !== '' && _jsx(Icon, { icon: menuItem.icon }), _jsx("div", { children: menuItem.label })] }) }, menuItem.id));
32
+ }
32
33
  };
33
- return (_jsxs(Menu, { id: menuId, onVisibilityChange: trackVisibility, theme: isDarkMode ? 'dark' : '', children: [_jsx(Item, { id: "focus-on-single-series", onClick: handleFocusOnSingleSeries, children: _jsxs("div", { className: "flex w-full items-center gap-2", children: [_jsx(Icon, { icon: "ph:star" }), _jsx("div", { children: "Focus only on this series" })] }) }), _jsx(Submenu, { label: _jsxs("div", { className: "flex w-full items-center gap-2", children: [_jsx(Icon, { icon: "material-symbols:add" }), _jsx("div", { children: "Add to query" })] }), children: _jsx("div", { className: "max-h-[300px] overflow-auto", children: labels == null || labels.length === 0 ? (_jsx(Item, { disabled: true, children: _jsxs("div", { className: "flex w-full items-center gap-2", children: [_jsx(Icon, { icon: "ph:warning" }), _jsx("div", { children: "No labels available" })] }) })) : (labels.map((label) => (_jsx(Item, { id: label.name, onClick: () => {
34
- onAddLabelMatcher({
35
- key: label.name,
36
- value: label.value,
37
- });
38
- }, className: "max-w-[400px] overflow-hidden", children: _jsx("div", { className: "mr-3 inline-block rounded-lg bg-gray-200 px-2 py-1 text-xs font-bold text-gray-700 dark:bg-gray-700 dark:text-gray-300", children: `${transformUtilizationLabels(label.name, utilizationMetrics)}="${label.value}"` }) }, label.name)))) }) })] }));
34
+ return (_jsx(Menu, { id: menuId, onVisibilityChange: trackVisibility, theme: isDarkMode ? 'dark' : '', children: menuItems.map(renderMenuItem) }));
39
35
  };
40
36
  export default MetricsContextMenu;
@@ -1,15 +1,9 @@
1
- import { HighlightedSeries } from '../';
2
1
  interface Props {
3
2
  x: number;
4
3
  y: number;
5
- highlighted: HighlightedSeries;
6
4
  contextElement: Element | null;
7
- sampleType: string;
8
- sampleUnit: string;
9
- delta: boolean;
10
- utilizationMetrics?: boolean;
11
- valuePrefix?: string;
5
+ content: React.ReactNode;
12
6
  }
13
- declare const MetricsTooltip: ({ x, y, highlighted, contextElement, sampleType, sampleUnit, delta, utilizationMetrics, valuePrefix, }: Props) => JSX.Element;
7
+ declare const MetricsTooltip: ({ x, y, contextElement, content }: Props) => JSX.Element;
14
8
  export default MetricsTooltip;
15
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/MetricsGraph/MetricsTooltip/index.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAAC,iBAAiB,EAAC,MAAM,KAAK,CAAC;AAEtC,UAAU,KAAK;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,iBAAiB,CAAC;IAC/B,cAAc,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA8BD,QAAA,MAAM,cAAc,GAAI,wGAUrB,KAAK,KAAG,GAAG,CAAC,OAyMd,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/MetricsGraph/MetricsTooltip/index.tsx"],"names":[],"mappings":"AAqBA,UAAU,KAAK;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,cAAc,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAkCD,QAAA,MAAM,cAAc,GAAI,mCAAiC,KAAK,KAAG,GAAG,CAAC,OA2DpE,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
2
  // Copyright 2022 The Parca Authors
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -12,89 +12,80 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
  import { useEffect, useMemo, useState } from 'react';
15
- import { Icon } from '@iconify/react';
16
15
  import { usePopper } from 'react-popper';
17
- import { TextWithTooltip, useParcaContext } from '@parca/components';
18
- import { formatDate, timePattern, valueFormatter } from '@parca/utilities';
19
16
  const virtualElement = {
20
17
  getBoundingClientRect: () => {
21
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
22
- return {
18
+ const emptyRect = {
23
19
  width: 0,
24
20
  height: 0,
25
21
  top: 0,
26
- left: 0,
27
22
  right: 0,
28
23
  bottom: 0,
24
+ left: 0,
25
+ x: 0,
26
+ y: 0,
27
+ toJSON: () => ({}),
29
28
  };
29
+ return emptyRect;
30
30
  },
31
31
  };
32
- function generateGetBoundingClientRect(contextElement, x = 0, y = 0) {
33
- const domRect = contextElement.getBoundingClientRect();
34
- return () =>
35
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
36
- ({
32
+ const createDomRect = (x, y) => {
33
+ const domRect = {
37
34
  width: 0,
38
35
  height: 0,
39
- top: domRect.y + y,
40
- left: domRect.x + x,
41
- right: domRect.x + x,
42
- bottom: domRect.y + y,
43
- });
44
- }
45
- const MetricsTooltip = ({ x, y, highlighted, contextElement, sampleType, sampleUnit, delta, utilizationMetrics = false, valuePrefix, }) => {
46
- const { timezone } = useParcaContext();
36
+ top: y,
37
+ right: x,
38
+ bottom: y,
39
+ left: x,
40
+ x,
41
+ y,
42
+ toJSON: () => ({}),
43
+ };
44
+ return domRect;
45
+ };
46
+ const MetricsTooltip = ({ x, y, contextElement, content }) => {
47
47
  const [popperElement, setPopperElement] = useState(null);
48
- const { styles, attributes, ...popperProps } = usePopper(virtualElement, popperElement, {
48
+ const { styles, attributes, update } = usePopper(virtualElement, popperElement, {
49
49
  placement: 'auto-start',
50
50
  strategy: 'absolute',
51
51
  modifiers: [
52
52
  {
53
53
  name: 'preventOverflow',
54
54
  options: {
55
- tether: false,
56
- altAxis: true,
55
+ boundary: contextElement ?? undefined,
57
56
  },
58
57
  },
59
58
  {
60
59
  name: 'offset',
61
60
  options: {
62
- offset: [30, 30],
61
+ offset: [15, 15],
63
62
  },
64
63
  },
65
64
  ],
66
65
  });
67
- const update = popperProps.update;
68
- const attributesMap = useMemo(() => {
69
- return highlighted.labels
70
- .filter(label => label.name.startsWith('attributes.') && !label.name.startsWith('attributes_resource.'))
71
- .reduce((acc, label) => {
72
- const key = label.name.replace('attributes.', '');
73
- acc[key] = label.value;
74
- return acc;
75
- }, {});
76
- }, [highlighted.labels]);
77
- const attributesResourceMap = useMemo(() => {
78
- return highlighted.labels
79
- .filter(label => label.name.startsWith('attributes_resource.'))
80
- .reduce((acc, label) => {
81
- const key = label.name.replace('attributes_resource.', '');
82
- acc[key] = label.value;
83
- return acc;
84
- }, {});
85
- }, [highlighted.labels]);
66
+ useMemo(() => {
67
+ virtualElement.getBoundingClientRect = () => {
68
+ const domRect = contextElement?.getBoundingClientRect() ?? {
69
+ width: 0,
70
+ height: 0,
71
+ top: 0,
72
+ right: 0,
73
+ bottom: 0,
74
+ left: 0,
75
+ x: 0,
76
+ y: 0,
77
+ toJSON: () => ({}),
78
+ };
79
+ return createDomRect(domRect.x + x, domRect.y + y);
80
+ };
81
+ }, [x, y, contextElement]);
86
82
  useEffect(() => {
87
- if (contextElement != null) {
88
- virtualElement.getBoundingClientRect = generateGetBoundingClientRect(contextElement, x, y);
89
- void update?.();
90
- }
91
- }, [x, y, contextElement, update]);
92
- const nameLabel = highlighted?.labels.find(e => e.name === '__name__');
93
- const highlightedNameLabel = nameLabel !== undefined ? nameLabel : { name: '', value: '' };
94
- return (_jsx("div", { ref: setPopperElement, style: styles.popper, ...attributes.popper, className: "z-50", children: _jsx("div", { className: "flex max-w-lg", children: _jsx("div", { className: "m-auto", children: _jsx("div", { className: "rounded-lg border-gray-300 bg-gray-50 p-3 opacity-90 shadow-lg dark:border-gray-500 dark:bg-gray-900", style: { borderWidth: 1 }, children: _jsx("div", { className: "flex flex-row", children: _jsxs("div", { className: "ml-2 mr-6", children: [_jsx("span", { className: "font-semibold", children: highlightedNameLabel.value }), _jsx("span", { className: "my-2 block text-gray-700 dark:text-gray-300", children: _jsx("table", { className: "table-auto", children: _jsxs("tbody", { children: [delta ? (_jsxs(_Fragment, { children: [_jsxs("tr", { children: [_jsx("td", { className: "w-1/4 pr-3", children: "Per\u00A0Second" }), _jsx("td", { className: "w-3/4", children: valueFormatter(highlighted.valuePerSecond, sampleUnit === 'nanoseconds' && sampleType === 'cpu'
95
- ? 'CPU Cores'
96
- : sampleUnit, 5) })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Total" }), _jsx("td", { className: "w-3/4", children: valueFormatter(highlighted.value, sampleUnit, 2) })] })] })) : (_jsxs("tr", { children: [_jsxs("td", { className: "w-1/4", children: [valuePrefix ?? '', "Value"] }), _jsx("td", { className: "w-3/4", children: valueFormatter(highlighted.valuePerSecond, sampleUnit, 5) })] })), highlighted.duration > 0 && (_jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Duration" }), _jsx("td", { className: "w-3/4", children: valueFormatter(highlighted.duration, 'nanoseconds', 2) })] })), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "At" }), _jsx("td", { className: "w-3/4", children: formatDate(highlighted.timestamp, timePattern(timezone), timezone) })] })] }) }) }), _jsx("span", { className: "my-2 block text-gray-500", children: utilizationMetrics ? (_jsxs(_Fragment, { children: [Object.keys(attributesResourceMap).length > 0 && (_jsx("span", { className: "text-sm font-bold text-gray-700 dark:text-white", children: "Resource Attributes" })), _jsx("span", { className: "my-2 block text-gray-500", children: Object.keys(attributesResourceMap).map(name => (_jsx("div", { className: "mr-3 inline-block rounded-lg bg-gray-200 px-2 py-1 text-xs font-bold text-gray-700 dark:bg-gray-700 dark:text-gray-400", children: _jsx(TextWithTooltip, { text: `${name.replace('attributes.', '')}="${attributesResourceMap[name]}"`, maxTextLength: 48, id: `tooltip-${name}-${attributesResourceMap[name]}` }) }, name))) }), Object.keys(attributesMap).length > 0 && (_jsx("span", { className: "text-sm font-bold text-gray-700 dark:text-white", children: "Attributes" })), _jsx("span", { className: "my-2 block text-gray-500", children: Object.keys(attributesMap).map(name => (_jsx("div", { className: "mr-3 inline-block rounded-lg bg-gray-200 px-2 py-1 text-xs font-bold text-gray-700 dark:bg-gray-700 dark:text-gray-400", children: _jsx(TextWithTooltip, { text: `${name.replace('attributes.', '')}="${attributesMap[name]}"`, maxTextLength: 48, id: `tooltip-${name}-${attributesMap[name]}` }) }, name))) })] })) : (_jsx(_Fragment, { children: highlighted.labels
97
- .filter((label) => label.name !== '__name__')
98
- .map((label) => (_jsx("div", { className: "mr-3 inline-block rounded-lg bg-gray-200 px-2 py-1 text-xs font-bold text-gray-700 dark:bg-gray-700 dark:text-gray-400", children: _jsx(TextWithTooltip, { text: `${label.name}="${label.value}"`, maxTextLength: 37, id: `tooltip-${label.name}` }) }, label.name))) })) }), _jsxs("div", { className: "flex w-full items-center gap-1 text-xs text-gray-500", children: [_jsx(Icon, { icon: "iconoir:mouse-button-right" }), _jsx("div", { children: "Right click to add labels to query." })] })] }) }) }) }) }) }));
83
+ void update?.();
84
+ }, [x, y, update]);
85
+ // Don't render anything if content is null or undefined
86
+ if (content == null) {
87
+ return _jsx(_Fragment, {});
88
+ }
89
+ return (_jsx("div", { ref: setPopperElement, style: styles.popper, ...attributes.popper, className: "z-50", children: _jsx("div", { className: "flex max-w-lg", children: _jsx("div", { className: "m-auto", children: _jsx("div", { className: "border border-gray-300 bg-gray-50 dark:border-gray-500 dark:bg-gray-900 rounded-lg shadow-lg px-3 py-2", children: content }) }) }) }));
99
90
  };
100
91
  export default MetricsTooltip;
@@ -19,14 +19,11 @@ interface CommonProps {
19
19
  key: string;
20
20
  value: string;
21
21
  }>;
22
- onSelectedSeriesChange?: (series: Array<{
23
- key: string;
24
- value: string;
25
- }>) => void;
22
+ onSeriesClick?: (seriesIndex: number) => void;
26
23
  }
27
24
  type Props = CommonProps & {
28
25
  utilizationMetricsLoading?: boolean;
29
26
  };
30
- declare const AreaChart: ({ transmitData, receiveData, addLabelMatcher, setTimeRange, utilizationMetricsLoading, name, humanReadableName, from, to, selectedSeries, onSelectedSeriesChange, }: Props) => JSX.Element;
27
+ declare const AreaChart: ({ transmitData, receiveData, addLabelMatcher, setTimeRange, utilizationMetricsLoading, name, humanReadableName, from, to, selectedSeries, onSeriesClick, }: Props) => JSX.Element;
31
28
  export default AreaChart;
32
29
  //# sourceMappingURL=Throughput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Throughput.d.ts","sourceRoot":"","sources":["../../../src/MetricsGraph/UtilizationMetrics/Throughput.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAC,aAAa,EAAqD,MAAM,mBAAmB,CAAC;AAIpG,OAAO,EAAC,KAAK,kBAAkB,IAAI,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAkB9E,UAAU,WAAW;IACnB,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,WAAW,EAAE,YAAY,EAAE,CAAC;IAC5B,eAAe,EAAE,CACf,MAAM,EAAE;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAAG,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC,K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