@parca/profile 0.16.343 → 0.16.344
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 +4 -0
- package/dist/MetricsGraph/index.d.ts +1 -1
- package/dist/MetricsGraph/index.js +2 -2
- package/dist/ProfileMetricsGraph/index.d.ts +1 -1
- package/dist/ProfileMetricsGraph/index.js +2 -2
- package/dist/ProfileSelector/index.js +3 -5
- package/package.json +2 -2
- package/src/MetricsGraph/index.tsx +3 -2
- package/src/ProfileMetricsGraph/index.tsx +13 -3
- package/src/ProfileSelector/index.tsx +9 -6
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.16.344](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.343...@parca/profile@0.16.344) (2024-02-21)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
6
10
|
## [0.16.343](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.342...@parca/profile@0.16.343) (2024-02-20)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @parca/profile
|
|
@@ -7,7 +7,7 @@ interface Props {
|
|
|
7
7
|
from: number;
|
|
8
8
|
to: number;
|
|
9
9
|
profile: MergedProfileSelection | null;
|
|
10
|
-
onSampleClick: (timestamp: number, value: number, labels: Label[]) => void;
|
|
10
|
+
onSampleClick: (timestamp: number, value: number, labels: Label[], duration: number) => void;
|
|
11
11
|
addLabelMatcher: (labels: {
|
|
12
12
|
key: string;
|
|
13
13
|
value: string;
|
|
@@ -139,8 +139,8 @@ export const RawMetricsGraph = ({ data, from, to, profile, onSampleClick, addLab
|
|
|
139
139
|
};
|
|
140
140
|
const openClosestProfile = () => {
|
|
141
141
|
if (highlighted != null) {
|
|
142
|
-
onSampleClick(Math.round(highlighted.timestamp), highlighted.value, sanitizeHighlightedValues(highlighted.labels) // When a user clicks on any sample in the graph, replace single `\` in the `labelValues` string with doubles `\\` if available.
|
|
143
|
-
);
|
|
142
|
+
onSampleClick(Math.round(highlighted.timestamp), highlighted.value, sanitizeHighlightedValues(highlighted.labels), // When a user clicks on any sample in the graph, replace single `\` in the `labelValues` string with doubles `\\` if available.
|
|
143
|
+
highlighted.duration);
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
const onMouseUp = (e) => {
|
|
@@ -21,7 +21,7 @@ interface ProfileMetricsGraphProps {
|
|
|
21
21
|
key: string;
|
|
22
22
|
value: string;
|
|
23
23
|
}>) => void;
|
|
24
|
-
onPointClick: (timestamp: number, labels: Label[], queryExpression: string) => void;
|
|
24
|
+
onPointClick: (timestamp: number, labels: Label[], queryExpression: string, duration: number) => void;
|
|
25
25
|
comparing?: boolean;
|
|
26
26
|
}
|
|
27
27
|
export interface IQueryRangeState {
|
|
@@ -88,8 +88,8 @@ const ProfileMetricsGraph = ({ queryClient, queryExpression, profile, from, to,
|
|
|
88
88
|
return _jsx(ErrorContent, { errorMessage: capitalizeOnlyFirstLetter(error.message) });
|
|
89
89
|
}
|
|
90
90
|
if (dataAvailable) {
|
|
91
|
-
const handleSampleClick = (timestamp, _value, labels) => {
|
|
92
|
-
onPointClick(timestamp, labels, queryExpression);
|
|
91
|
+
const handleSampleClick = (timestamp, _value, labels, duration) => {
|
|
92
|
+
onPointClick(timestamp, labels, queryExpression, duration);
|
|
93
93
|
};
|
|
94
94
|
let sampleUnit = '';
|
|
95
95
|
if (series.every((val, i, arr) => val?.sampleType?.unit === arr[0]?.sampleType?.unit)) {
|
|
@@ -15,7 +15,6 @@ import { useEffect, useState } from 'react';
|
|
|
15
15
|
import { Button, ButtonGroup, DateTimeRange, DateTimeRangePicker, IconButton, useGrpcMetadata, useParcaContext, } from '@parca/components';
|
|
16
16
|
import { CloseIcon } from '@parca/icons';
|
|
17
17
|
import { Query } from '@parca/parser';
|
|
18
|
-
import { getStepDuration, getStepDurationInMilliseconds } from '@parca/utilities';
|
|
19
18
|
import { MergedProfileSelection } from '..';
|
|
20
19
|
import MatchersInput from '../MatchersInput/index';
|
|
21
20
|
import { useMetricsGraphDimensions } from '../MetricsGraph/useMetricsGraphDimensions';
|
|
@@ -177,7 +176,7 @@ const ProfileSelector = ({ queryClient, querySelection, selectProfile, selectQue
|
|
|
177
176
|
timeSelection: range.getRangeKey(),
|
|
178
177
|
...mergedProfileParams,
|
|
179
178
|
});
|
|
180
|
-
}, addLabelMatcher: addLabelMatcher, onPointClick: (timestamp, labels, queryExpression) => {
|
|
179
|
+
}, addLabelMatcher: addLabelMatcher, onPointClick: (timestamp, labels, queryExpression, duration) => {
|
|
181
180
|
// TODO: Pass the query object via click rather than queryExpression
|
|
182
181
|
let query = Query.parse(queryExpression);
|
|
183
182
|
labels.forEach(l => {
|
|
@@ -186,11 +185,10 @@ const ProfileSelector = ({ queryClient, querySelection, selectProfile, selectQue
|
|
|
186
185
|
query = newQuery;
|
|
187
186
|
}
|
|
188
187
|
});
|
|
189
|
-
const
|
|
190
|
-
const stepDurationInMilliseconds = getStepDurationInMilliseconds(stepDuration);
|
|
188
|
+
const durationInMilliseconds = duration / 1000000; // duration is in nanoseconds
|
|
191
189
|
const mergeFrom = timestamp;
|
|
192
190
|
const mergeTo = query.profileType().delta
|
|
193
|
-
? mergeFrom +
|
|
191
|
+
? mergeFrom + durationInMilliseconds
|
|
194
192
|
: mergeFrom;
|
|
195
193
|
selectProfile(new MergedProfileSelection(mergeFrom, mergeTo, query));
|
|
196
194
|
} }) })) : (_jsx(_Fragment, { children: profileSelection == null ? (_jsx("div", { className: "p-2", children: _jsx(ProfileMetricsEmptyState, { message: `Please select a profile type and click "Search" to begin.` }) })) : null })) }) })] }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.344",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@parca/client": "^0.16.103",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"access": "public",
|
|
52
52
|
"registry": "https://registry.npmjs.org/"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "419fad9b80e702bafd775521f69a812bc5e81124"
|
|
55
55
|
}
|
|
@@ -40,7 +40,7 @@ interface Props {
|
|
|
40
40
|
from: number;
|
|
41
41
|
to: number;
|
|
42
42
|
profile: MergedProfileSelection | null;
|
|
43
|
-
onSampleClick: (timestamp: number, value: number, labels: Label[]) => void;
|
|
43
|
+
onSampleClick: (timestamp: number, value: number, labels: Label[], duration: number) => void;
|
|
44
44
|
addLabelMatcher: (
|
|
45
45
|
labels: {key: string; value: string} | Array<{key: string; value: string}>
|
|
46
46
|
) => void;
|
|
@@ -260,7 +260,8 @@ export const RawMetricsGraph = ({
|
|
|
260
260
|
onSampleClick(
|
|
261
261
|
Math.round(highlighted.timestamp),
|
|
262
262
|
highlighted.value,
|
|
263
|
-
sanitizeHighlightedValues(highlighted.labels) // When a user clicks on any sample in the graph, replace single `\` in the `labelValues` string with doubles `\\` if available.
|
|
263
|
+
sanitizeHighlightedValues(highlighted.labels), // When a user clicks on any sample in the graph, replace single `\` in the `labelValues` string with doubles `\\` if available.
|
|
264
|
+
highlighted.duration
|
|
264
265
|
);
|
|
265
266
|
}
|
|
266
267
|
};
|
|
@@ -64,7 +64,12 @@ interface ProfileMetricsGraphProps {
|
|
|
64
64
|
addLabelMatcher: (
|
|
65
65
|
labels: {key: string; value: string} | Array<{key: string; value: string}>
|
|
66
66
|
) => void;
|
|
67
|
-
onPointClick: (
|
|
67
|
+
onPointClick: (
|
|
68
|
+
timestamp: number,
|
|
69
|
+
labels: Label[],
|
|
70
|
+
queryExpression: string,
|
|
71
|
+
duration: number
|
|
72
|
+
) => void;
|
|
68
73
|
comparing?: boolean;
|
|
69
74
|
}
|
|
70
75
|
|
|
@@ -168,8 +173,13 @@ const ProfileMetricsGraph = ({
|
|
|
168
173
|
}
|
|
169
174
|
|
|
170
175
|
if (dataAvailable) {
|
|
171
|
-
const handleSampleClick = (
|
|
172
|
-
|
|
176
|
+
const handleSampleClick = (
|
|
177
|
+
timestamp: number,
|
|
178
|
+
_value: number,
|
|
179
|
+
labels: Label[],
|
|
180
|
+
duration: number
|
|
181
|
+
): void => {
|
|
182
|
+
onPointClick(timestamp, labels, queryExpression, duration);
|
|
173
183
|
};
|
|
174
184
|
|
|
175
185
|
let sampleUnit = '';
|
|
@@ -15,7 +15,7 @@ import React, {useEffect, useState} from 'react';
|
|
|
15
15
|
|
|
16
16
|
import {RpcError} from '@protobuf-ts/runtime-rpc';
|
|
17
17
|
|
|
18
|
-
import {ProfileTypesResponse, QueryServiceClient} from '@parca/client';
|
|
18
|
+
import {Label, ProfileTypesResponse, QueryServiceClient} from '@parca/client';
|
|
19
19
|
import {
|
|
20
20
|
Button,
|
|
21
21
|
ButtonGroup,
|
|
@@ -27,7 +27,6 @@ import {
|
|
|
27
27
|
} from '@parca/components';
|
|
28
28
|
import {CloseIcon} from '@parca/icons';
|
|
29
29
|
import {Query} from '@parca/parser';
|
|
30
|
-
import {getStepDuration, getStepDurationInMilliseconds} from '@parca/utilities';
|
|
31
30
|
|
|
32
31
|
import {MergedProfileSelection, ProfileSelection} from '..';
|
|
33
32
|
import MatchersInput from '../MatchersInput/index';
|
|
@@ -327,7 +326,12 @@ const ProfileSelector = ({
|
|
|
327
326
|
});
|
|
328
327
|
}}
|
|
329
328
|
addLabelMatcher={addLabelMatcher}
|
|
330
|
-
onPointClick={(
|
|
329
|
+
onPointClick={(
|
|
330
|
+
timestamp: number,
|
|
331
|
+
labels: Label[],
|
|
332
|
+
queryExpression: string,
|
|
333
|
+
duration: number
|
|
334
|
+
) => {
|
|
331
335
|
// TODO: Pass the query object via click rather than queryExpression
|
|
332
336
|
let query = Query.parse(queryExpression);
|
|
333
337
|
labels.forEach(l => {
|
|
@@ -337,11 +341,10 @@ const ProfileSelector = ({
|
|
|
337
341
|
}
|
|
338
342
|
});
|
|
339
343
|
|
|
340
|
-
const
|
|
341
|
-
const stepDurationInMilliseconds = getStepDurationInMilliseconds(stepDuration);
|
|
344
|
+
const durationInMilliseconds = duration / 1000000; // duration is in nanoseconds
|
|
342
345
|
const mergeFrom = timestamp;
|
|
343
346
|
const mergeTo = query.profileType().delta
|
|
344
|
-
? mergeFrom +
|
|
347
|
+
? mergeFrom + durationInMilliseconds
|
|
345
348
|
: mergeFrom;
|
|
346
349
|
selectProfile(new MergedProfileSelection(mergeFrom, mergeTo, query));
|
|
347
350
|
}}
|