@parca/profile 0.16.75 → 0.16.77
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/MatchersInput/index.js +6 -3
- package/dist/MetricsGraph/index.js +3 -2
- package/dist/ProfileSelector/index.js +4 -1
- package/dist/ProfileSource.js +1 -1
- package/package.json +4 -4
- package/src/MatchersInput/index.tsx +9 -4
- package/src/MetricsGraph/index.tsx +6 -2
- package/src/ProfileSelector/index.tsx +4 -1
- package/src/ProfileSource.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.77](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.76...@parca/profile@0.16.77) (2022-11-29)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
10
|
+
## [0.16.76](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.75...@parca/profile@0.16.76) (2022-11-29)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @parca/profile
|
|
13
|
+
|
|
6
14
|
## 0.16.75 (2022-11-29)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @parca/profile
|
|
@@ -23,11 +23,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
23
23
|
// See the License for the specific language governing permissions and
|
|
24
24
|
// limitations under the License.
|
|
25
25
|
import { useState, useEffect, useMemo, useRef } from 'react';
|
|
26
|
-
import { Query } from '@parca/parser';
|
|
27
26
|
import TextareaAutosize from 'react-textarea-autosize';
|
|
28
27
|
import cx from 'classnames';
|
|
29
|
-
import SuggestionsList, { Suggestion, Suggestions } from './SuggestionsList';
|
|
30
28
|
import { useGrpcMetadata } from '@parca/components';
|
|
29
|
+
import { sanitizeLabelValue } from '@parca/functions';
|
|
30
|
+
import { Query } from '@parca/parser';
|
|
31
|
+
import SuggestionsList, { Suggestion, Suggestions } from './SuggestionsList';
|
|
31
32
|
export var useLabelNames = function (client) {
|
|
32
33
|
var _a = useState(true), loading = _a[0], setLoading = _a[1];
|
|
33
34
|
var _b = useState({}), result = _b[0], setResult = _b[1];
|
|
@@ -59,7 +60,9 @@ var MatchersInput = function (_a) {
|
|
|
59
60
|
setLabelValuesLoading(true);
|
|
60
61
|
call.response
|
|
61
62
|
.then(function (response) {
|
|
62
|
-
|
|
63
|
+
// replace single `\` in the `labelValues` string with doubles `\\` if available.
|
|
64
|
+
var newValues = sanitizeLabelValue(response.labelValues);
|
|
65
|
+
setLabelValues(newValues);
|
|
63
66
|
})
|
|
64
67
|
.catch(function () { return setLabelValues(null); })
|
|
65
68
|
.finally(function () { return setLabelValuesLoading(false); });
|
|
@@ -41,7 +41,7 @@ import { timeFormat } from '..';
|
|
|
41
41
|
import { cutToMaxStringLength } from '@parca/functions/string';
|
|
42
42
|
import throttle from 'lodash.throttle';
|
|
43
43
|
import { usePopper } from 'react-popper';
|
|
44
|
-
import { valueFormatter, formatDate } from '@parca/functions';
|
|
44
|
+
import { valueFormatter, formatDate, sanitizeHighlightedValues } from '@parca/functions';
|
|
45
45
|
import { DateTimeRange } from '@parca/components';
|
|
46
46
|
import { useContainerDimensions } from '@parca/dynamicsize';
|
|
47
47
|
import useIsShiftDown from '@parca/components/src/hooks/useIsShiftDown';
|
|
@@ -226,7 +226,8 @@ export var RawMetricsGraph = function (_a) {
|
|
|
226
226
|
};
|
|
227
227
|
var openClosestProfile = function () {
|
|
228
228
|
if (highlighted != null) {
|
|
229
|
-
onSampleClick(Math.round(highlighted.timestamp), highlighted.value, highlighted.labels)
|
|
229
|
+
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.
|
|
230
|
+
);
|
|
230
231
|
}
|
|
231
232
|
};
|
|
232
233
|
var onMouseUp = function (e) {
|
|
@@ -84,7 +84,10 @@ var ProfileSelector = function (_a) {
|
|
|
84
84
|
setNewQueryExpression(query.toString(), false);
|
|
85
85
|
};
|
|
86
86
|
var addLabelMatcher = function (key, value) {
|
|
87
|
-
|
|
87
|
+
// When a user clicks on a label on the metrics graph tooltip,
|
|
88
|
+
// replace single `\` in the `value` string with doubles `\\` if available.
|
|
89
|
+
var newValue = value.includes('\\') ? value.replaceAll('\\', '\\\\') : value;
|
|
90
|
+
var _a = Query.parse(queryExpressionString).setMatcher(key, newValue), newQuery = _a[0], changed = _a[1];
|
|
88
91
|
if (changed) {
|
|
89
92
|
setNewQueryExpression(newQuery.toString(), false);
|
|
90
93
|
}
|
package/dist/ProfileSource.js
CHANGED
|
@@ -60,7 +60,7 @@ var SingleProfileSelection = /** @class */ (function () {
|
|
|
60
60
|
SingleProfileSelection.prototype.HistoryParams = function () {
|
|
61
61
|
return {
|
|
62
62
|
profile_name: this.profileName,
|
|
63
|
-
labels: this.labels.map(function (label) { return "".concat(label.name, "=").concat(label.value); }),
|
|
63
|
+
labels: this.labels.map(function (label) { return "".concat(label.name, "=").concat(encodeURIComponent(label.value)); }),
|
|
64
64
|
time: this.time,
|
|
65
65
|
};
|
|
66
66
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.77",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@parca/client": "^0.16.56",
|
|
7
|
-
"@parca/components": "^0.16.
|
|
7
|
+
"@parca/components": "^0.16.67",
|
|
8
8
|
"@parca/dynamicsize": "^0.16.51",
|
|
9
|
-
"@parca/functions": "^0.16.
|
|
9
|
+
"@parca/functions": "^0.16.53",
|
|
10
10
|
"@parca/parser": "^0.16.51",
|
|
11
11
|
"@parca/store": "^0.16.50",
|
|
12
12
|
"d3": "7.6.1",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"access": "public",
|
|
43
43
|
"registry": "https://registry.npmjs.org/"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "32660c63e7b5d189c3e29abb0321d8e49bbcbc28"
|
|
46
46
|
}
|
|
@@ -12,13 +12,15 @@
|
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
|
|
14
14
|
import React, {useState, useEffect, useMemo, useRef} from 'react';
|
|
15
|
-
import {Query} from '@parca/parser';
|
|
16
|
-
import {LabelsResponse, QueryServiceClient} from '@parca/client';
|
|
17
15
|
import TextareaAutosize from 'react-textarea-autosize';
|
|
18
16
|
import cx from 'classnames';
|
|
19
17
|
|
|
20
|
-
import SuggestionsList, {Suggestion, Suggestions} from './SuggestionsList';
|
|
21
18
|
import {useGrpcMetadata} from '@parca/components';
|
|
19
|
+
import {sanitizeLabelValue} from '@parca/functions';
|
|
20
|
+
import {Query} from '@parca/parser';
|
|
21
|
+
import {LabelsResponse, QueryServiceClient} from '@parca/client';
|
|
22
|
+
|
|
23
|
+
import SuggestionsList, {Suggestion, Suggestions} from './SuggestionsList';
|
|
22
24
|
|
|
23
25
|
interface MatchersInputProps {
|
|
24
26
|
queryClient: QueryServiceClient;
|
|
@@ -79,7 +81,10 @@ const MatchersInput = ({
|
|
|
79
81
|
|
|
80
82
|
call.response
|
|
81
83
|
.then(response => {
|
|
82
|
-
|
|
84
|
+
// replace single `\` in the `labelValues` string with doubles `\\` if available.
|
|
85
|
+
const newValues = sanitizeLabelValue(response.labelValues);
|
|
86
|
+
|
|
87
|
+
setLabelValues(newValues);
|
|
83
88
|
})
|
|
84
89
|
.catch(() => setLabelValues(null))
|
|
85
90
|
.finally(() => setLabelValuesLoading(false));
|
|
@@ -21,7 +21,7 @@ import throttle from 'lodash.throttle';
|
|
|
21
21
|
import {MetricsSeries as MetricsSeriesPb, MetricsSample, Label} from '@parca/client';
|
|
22
22
|
import {usePopper} from 'react-popper';
|
|
23
23
|
import type {VirtualElement} from '@popperjs/core';
|
|
24
|
-
import {valueFormatter, formatDate} from '@parca/functions';
|
|
24
|
+
import {valueFormatter, formatDate, sanitizeHighlightedValues} from '@parca/functions';
|
|
25
25
|
import {DateTimeRange} from '@parca/components';
|
|
26
26
|
import {useContainerDimensions} from '@parca/dynamicsize';
|
|
27
27
|
import useIsShiftDown from '@parca/components/src/hooks/useIsShiftDown';
|
|
@@ -362,7 +362,11 @@ export const RawMetricsGraph = ({
|
|
|
362
362
|
|
|
363
363
|
const openClosestProfile = (): void => {
|
|
364
364
|
if (highlighted != null) {
|
|
365
|
-
onSampleClick(
|
|
365
|
+
onSampleClick(
|
|
366
|
+
Math.round(highlighted.timestamp),
|
|
367
|
+
highlighted.value,
|
|
368
|
+
sanitizeHighlightedValues(highlighted.labels) // When a user clicks on any sample in the graph, replace single `\` in the `labelValues` string with doubles `\\` if available.
|
|
369
|
+
);
|
|
366
370
|
}
|
|
367
371
|
};
|
|
368
372
|
|
|
@@ -138,7 +138,10 @@ const ProfileSelector = ({
|
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
const addLabelMatcher = (key: string, value: string): void => {
|
|
141
|
-
|
|
141
|
+
// When a user clicks on a label on the metrics graph tooltip,
|
|
142
|
+
// replace single `\` in the `value` string with doubles `\\` if available.
|
|
143
|
+
const newValue = value.includes('\\') ? value.replaceAll('\\', '\\\\') : value;
|
|
144
|
+
const [newQuery, changed] = Query.parse(queryExpressionString).setMatcher(key, newValue);
|
|
142
145
|
if (changed) {
|
|
143
146
|
setNewQueryExpression(newQuery.toString(), false);
|
|
144
147
|
}
|
package/src/ProfileSource.tsx
CHANGED
|
@@ -113,7 +113,7 @@ export class SingleProfileSelection implements ProfileSelection {
|
|
|
113
113
|
HistoryParams(): {[key: string]: any} {
|
|
114
114
|
return {
|
|
115
115
|
profile_name: this.profileName,
|
|
116
|
-
labels: this.labels.map(label => `${label.name}=${label.value}`),
|
|
116
|
+
labels: this.labels.map(label => `${label.name}=${encodeURIComponent(label.value)}`),
|
|
117
117
|
time: this.time,
|
|
118
118
|
};
|
|
119
119
|
}
|