@parca/profile 0.16.370 → 0.16.373

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 CHANGED
@@ -3,6 +3,18 @@
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.16.373](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.372...@parca/profile@0.16.373) (2024-05-16)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
10
+ ## [0.16.372](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.371...@parca/profile@0.16.372) (2024-05-16)
11
+
12
+ **Note:** Version bump only for package @parca/profile
13
+
14
+ ## [0.16.371](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.370...@parca/profile@0.16.371) (2024-05-16)
15
+
16
+ **Note:** Version bump only for package @parca/profile
17
+
6
18
  ## [0.16.370](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.369...@parca/profile@0.16.370) (2024-05-14)
7
19
 
8
20
  **Note:** Version bump only for package @parca/profile
@@ -117,6 +117,11 @@ export class ProfileDiffSource {
117
117
  return (_jsx(_Fragment, { children: _jsx("p", { children: "Browse the comparison" }) }));
118
118
  }
119
119
  toString() {
120
+ const aDesc = this.a.toString();
121
+ const bDesc = this.b.toString();
122
+ if (aDesc === bDesc) {
123
+ return 'profile comparison';
124
+ }
120
125
  return `${this.a.toString()} compared with ${this.b.toString()}`;
121
126
  }
122
127
  }
@@ -164,6 +169,14 @@ export class MergedProfileSource {
164
169
  .map((m) => `${m.key}=${m.value}`);
165
170
  }
166
171
  toString(timezone) {
167
- return `merged profiles of query "${this.query.toString()}" from ${formatDate(this.mergeFrom, timeFormat(timezone), timezone)} to ${formatDate(this.mergeTo, timeFormat(timezone), timezone)}`;
172
+ let queryPart = '';
173
+ if (this.query.toString()?.length > 0) {
174
+ queryPart = ` of query "${this.query.toString()}"`;
175
+ }
176
+ let timePart = '';
177
+ if (this.mergeFrom !== 0) {
178
+ timePart = ` from ${formatDate(this.mergeFrom, timeFormat(timezone), timezone)} to ${formatDate(this.mergeTo, timeFormat(timezone), timezone)}`;
179
+ }
180
+ return `merged profiles${queryPart}${timePart}`;
168
181
  }
169
182
  }
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.16.370",
3
+ "version": "0.16.373",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@headlessui/react": "^1.7.19",
7
7
  "@iconify/react": "^4.0.0",
8
- "@parca/client": "^0.16.113",
9
- "@parca/components": "^0.16.275",
10
- "@parca/dynamicsize": "^0.16.64",
11
- "@parca/hooks": "^0.0.55",
12
- "@parca/icons": "^0.16.68",
13
- "@parca/parser": "^0.16.73",
14
- "@parca/store": "^0.16.144",
15
- "@parca/utilities": "^0.0.72",
8
+ "@parca/client": "^0.16.114",
9
+ "@parca/components": "^0.16.277",
10
+ "@parca/dynamicsize": "^0.16.65",
11
+ "@parca/hooks": "^0.0.56",
12
+ "@parca/icons": "^0.16.69",
13
+ "@parca/parser": "^0.16.74",
14
+ "@parca/store": "^0.16.145",
15
+ "@parca/utilities": "^0.0.73",
16
16
  "@popperjs/core": "^2.11.8",
17
17
  "@protobuf-ts/runtime-rpc": "^2.5.0",
18
18
  "@tanstack/react-query": "^4.0.5",
@@ -71,5 +71,5 @@
71
71
  "access": "public",
72
72
  "registry": "https://registry.npmjs.org/"
73
73
  },
74
- "gitHead": "6fb2ee469c00ba81c6b1317771127fdf5806dced"
74
+ "gitHead": "80826885820b5f15cc6559c47293cad10249f85f"
75
75
  }
@@ -182,6 +182,13 @@ export class ProfileDiffSource implements ProfileSource {
182
182
  }
183
183
 
184
184
  toString(): string {
185
+ const aDesc = this.a.toString();
186
+ const bDesc = this.b.toString();
187
+
188
+ if (aDesc === bDesc) {
189
+ return 'profile comparison';
190
+ }
191
+
185
192
  return `${this.a.toString()} compared with ${this.b.toString()}`;
186
193
  }
187
194
  }
@@ -240,10 +247,20 @@ export class MergedProfileSource implements ProfileSource {
240
247
  }
241
248
 
242
249
  toString(timezone?: string): string {
243
- return `merged profiles of query "${this.query.toString()}" from ${formatDate(
244
- this.mergeFrom,
245
- timeFormat(timezone),
246
- timezone
247
- )} to ${formatDate(this.mergeTo, timeFormat(timezone), timezone)}`;
250
+ let queryPart = '';
251
+ if (this.query.toString()?.length > 0) {
252
+ queryPart = ` of query "${this.query.toString()}"`;
253
+ }
254
+
255
+ let timePart = '';
256
+ if (this.mergeFrom !== 0) {
257
+ timePart = ` from ${formatDate(
258
+ this.mergeFrom,
259
+ timeFormat(timezone),
260
+ timezone
261
+ )} to ${formatDate(this.mergeTo, timeFormat(timezone), timezone)}`;
262
+ }
263
+
264
+ return `merged profiles${queryPart}${timePart}`;
248
265
  }
249
266
  }
@@ -1,5 +0,0 @@
1
- declare const GroupByDropdown: ({ groupBy, toggleGroupBy, }: {
2
- groupBy: string[];
3
- toggleGroupBy: (key: string) => void;
4
- }) => React.JSX.Element;
5
- export default GroupByDropdown;
@@ -1,11 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Menu, Transition } from '@headlessui/react';
3
- const GroupByDropdown = ({ groupBy, toggleGroupBy, }) => {
4
- const label = groupBy.length === 0
5
- ? 'Nothing'
6
- : groupBy.length === 1
7
- ? groupByOptions.find(option => option.value === groupBy[0])?.label
8
- : 'Multiple';
9
- return (_jsxs("div", { children: [_jsx("label", { className: "text-sm", children: "Group" }), _jsxs(Menu, { as: "div", className: "relative text-left", children: [_jsx("div", { children: _jsxs(Menu.Button, { className: "relative w-full cursor-default rounded-md border bg-white py-2 pl-3 pr-10 text-left text-sm shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 dark:border-gray-600 dark:bg-gray-900 sm:text-sm", children: [_jsx("span", { className: "block overflow-x-hidden text-ellipsis", children: label }), _jsx("span", { className: "pointer-events-none absolute inset-y-0 right-0 ml-3 flex items-center pr-2 text-gray-400", children: _jsx(Icon, { icon: "heroicons:chevron-down-20-solid", "aria-hidden": "true" }) })] }) }), _jsx(Transition, { as: Fragment, leave: "transition ease-in duration-100", leaveFrom: "opacity-100", leaveTo: "opacity-0", children: _jsx(Menu.Items, { className: "absolute left-0 z-10 mt-1 min-w-[400px] overflow-auto rounded-md bg-gray-50 py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:border-gray-600 dark:bg-gray-900 dark:ring-white dark:ring-opacity-20 sm:text-sm", children: _jsx("div", { className: "p-4", children: _jsx("fieldset", { children: _jsx("div", { className: "space-y-5", children: groupByOptions.map(({ value, label, description, disabled }) => (_jsxs("div", { className: "relative flex items-start", children: [_jsx("div", { className: "flex h-6 items-center", children: _jsx("input", { id: value, name: value, type: "checkbox", disabled: disabled, className: "h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600", checked: groupBy.includes(value), onChange: () => toggleGroupBy(value) }) }), _jsxs("div", { className: "ml-3 text-sm leading-6", children: [_jsx("label", { htmlFor: value, className: "font-medium text-gray-900 dark:text-gray-200", children: label }), _jsx("p", { className: "text-gray-500 dark:text-gray-400", children: description })] })] }, value))) }) }) }) }) })] })] }));
10
- };
11
- export default GroupByDropdown;
@@ -1,9 +0,0 @@
1
- declare const RuntimeFilterDropdown: ({ showRuntimeRuby, toggleShowRuntimeRuby, showRuntimePython, toggleShowRuntimePython, showInterpretedOnly, toggleShowInterpretedOnly, }: {
2
- showRuntimeRuby: boolean;
3
- toggleShowRuntimeRuby: () => void;
4
- showRuntimePython: boolean;
5
- toggleShowRuntimePython: () => void;
6
- showInterpretedOnly: boolean;
7
- toggleShowInterpretedOnly: () => void;
8
- }) => React.JSX.Element;
9
- export default RuntimeFilterDropdown;
@@ -1,11 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Fragment } from 'react';
3
- import { Menu, Transition } from '@headlessui/react';
4
- import { Icon } from '@iconify/react';
5
- const RuntimeToggle = ({ id, state, toggle, label, description, }) => {
6
- return (_jsxs("div", { className: "relative flex items-start", children: [_jsx("div", { className: "flex h-6 items-center", children: _jsx("input", { id: id, name: id, type: "checkbox", className: "h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600", checked: state, onChange: () => toggle() }) }), _jsxs("div", { className: "ml-3 text-sm leading-6", children: [_jsx("label", { htmlFor: id, className: "font-medium text-gray-900 dark:text-gray-200", children: label }), _jsx("p", { className: "text-gray-500 dark:text-gray-400", children: description })] })] }, id));
7
- };
8
- const RuntimeFilterDropdown = ({ showRuntimeRuby, toggleShowRuntimeRuby, showRuntimePython, toggleShowRuntimePython, showInterpretedOnly, toggleShowInterpretedOnly, }) => {
9
- return (_jsxs("div", { children: [_jsx("label", { className: "text-sm", children: "Runtimes" }), _jsxs(Menu, { as: "div", className: "relative text-left", children: [_jsx("div", { children: _jsxs(Menu.Button, { className: "relative w-full cursor-default rounded-md border bg-white py-2 pl-3 pr-10 text-left text-sm shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 dark:border-gray-600 dark:bg-gray-900 sm:text-sm", children: [_jsx("span", { className: "block overflow-x-hidden text-ellipsis", children: "Runtimes" }), _jsx("span", { className: "pointer-events-none absolute inset-y-0 right-0 ml-3 flex items-center pr-2 text-gray-400", children: _jsx(Icon, { icon: "heroicons:chevron-down-20-solid", "aria-hidden": "true" }) })] }) }), _jsx(Transition, { as: Fragment, leave: "transition ease-in duration-100", leaveFrom: "opacity-100", leaveTo: "opacity-0", children: _jsx(Menu.Items, { className: "absolute left-0 z-10 mt-1 min-w-[400px] overflow-auto rounded-md bg-gray-50 py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:border-gray-600 dark:bg-gray-900 dark:ring-white dark:ring-opacity-20 sm:text-sm", children: _jsx("div", { className: "p-4", children: _jsx("fieldset", { children: _jsxs("div", { className: "space-y-5", children: [_jsx(RuntimeToggle, { id: "show-runtime-ruby", state: showRuntimeRuby, toggle: toggleShowRuntimeRuby, label: "Ruby", description: "Show Ruby runtime functions." }), _jsx(RuntimeToggle, { id: "show-runtime-python", state: showRuntimePython, toggle: toggleShowRuntimePython, label: "Python", description: "Show Python runtime functions." }), _jsx(RuntimeToggle, { id: "show-interpreted-only", state: showInterpretedOnly, toggle: toggleShowInterpretedOnly, label: "Interpreted Only", description: "Show only interpreted functions." })] }) }) }) }) })] })] }));
10
- };
11
- export default RuntimeFilterDropdown;
@@ -1,6 +0,0 @@
1
- declare const SortBySelect: ({ sortBy, setSortBy, compareMode, }: {
2
- sortBy: string;
3
- setSortBy: (key: string) => void;
4
- compareMode: boolean;
5
- }) => React.JSX.Element;
6
- export default SortBySelect;
@@ -1,31 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { FIELD_CUMULATIVE, FIELD_DIFF, FIELD_FUNCTION_NAME, } from './IcicleGraphArrow';
3
- const SortBySelect = ({ sortBy, setSortBy, compareMode, }) => {
4
- return (_jsxs("div", { children: [_jsx("label", { className: "text-sm", children: "Sort" }), _jsx(Select, { items: [
5
- {
6
- key: FIELD_FUNCTION_NAME,
7
- disabled: false,
8
- element: {
9
- active: _jsx(_Fragment, { children: "Function" }),
10
- expanded: (_jsx(_Fragment, { children: _jsx("span", { children: "Function" }) })),
11
- },
12
- },
13
- {
14
- key: FIELD_CUMULATIVE,
15
- disabled: false,
16
- element: {
17
- active: _jsx(_Fragment, { children: "Cumulative" }),
18
- expanded: (_jsx(_Fragment, { children: _jsx("span", { children: "Cumulative" }) })),
19
- },
20
- },
21
- {
22
- key: FIELD_DIFF,
23
- disabled: !compareMode,
24
- element: {
25
- active: _jsx(_Fragment, { children: "Diff" }),
26
- expanded: (_jsx(_Fragment, { children: _jsx("span", { children: "Diff" }) })),
27
- },
28
- },
29
- ], selectedKey: sortBy, onSelection: key => setSortBy(key), placeholder: 'Sort By', primary: false, disabled: false })] }));
30
- };
31
- export default SortBySelect;
@@ -1,12 +0,0 @@
1
- import { QueryServiceClient } from '@parca/client';
2
- import { DateTimeRange } from '@parca/components';
3
- import { QuerySelection } from '../ProfileSelector';
4
- interface Props {
5
- queryClient: QueryServiceClient;
6
- selectQuery: (query: QuerySelection) => void;
7
- enforcedProfileName: string;
8
- timeRangeSelection: DateTimeRange;
9
- querySelection: QuerySelection;
10
- }
11
- declare const QueryBrowser: ({ queryClient, enforcedProfileName, timeRangeSelection, selectQuery, querySelection, }: Props) => import("react/jsx-runtime").JSX.Element;
12
- export default QueryBrowser;
@@ -1,51 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
3
- import { Query } from '@parca/parser';
4
- import MatchersInput from '../MatchersInput';
5
- const QueryBrowser = ({ queryClient, enforcedProfileName, timeRangeSelection, selectQuery, querySelection, }) => {
6
- const [queryExpressionString, setQueryExpressionString] = useState(querySelection.expression);
7
- useEffect(() => {
8
- if (enforcedProfileName !== '') {
9
- const [q, changed] = Query.parse(querySelection.expression).setProfileName(enforcedProfileName);
10
- if (changed) {
11
- setQueryExpressionString(q.toString());
12
- return;
13
- }
14
- }
15
- setQueryExpressionString(querySelection.expression);
16
- }, [enforcedProfileName, querySelection.expression]);
17
- const enforcedProfileNameQuery = () => {
18
- const pq = Query.parse(queryExpressionString);
19
- const [q] = pq.setProfileName(enforcedProfileName);
20
- return q;
21
- };
22
- const setMatchersString = (matchers) => {
23
- const newExpressionString = `${''}{${matchers}}`;
24
- setQueryExpressionString(newExpressionString);
25
- };
26
- const setNewQueryExpression = (expr) => {
27
- const query = enforcedProfileName !== '' ? enforcedProfileNameQuery() : Query.parse(expr);
28
- const delta = query.profileType().delta;
29
- const from = timeRangeSelection.getFromMs();
30
- const to = timeRangeSelection.getToMs();
31
- const mergeParams = delta
32
- ? {
33
- mergeFrom: from,
34
- mergeTo: to,
35
- }
36
- : {};
37
- selectQuery({
38
- expression: expr,
39
- from,
40
- to,
41
- timeSelection: timeRangeSelection.getRangeKey(),
42
- ...mergeParams,
43
- });
44
- };
45
- const query = enforcedProfileName !== '' ? enforcedProfileNameQuery() : Query.parse(queryExpressionString);
46
- const setQueryExpression = () => {
47
- setNewQueryExpression(query.toString());
48
- };
49
- return (_jsx(_Fragment, { children: _jsx(MatchersInput, { queryClient: queryClient, setMatchersString: setMatchersString, runQuery: setQueryExpression, currentQuery: query }) }));
50
- };
51
- export default QueryBrowser;