@parca/profile 0.16.501 → 0.16.503

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,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.503](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.502...@parca/profile@0.16.503) (2025-04-30)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
10
+ ## [0.16.502](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.501...@parca/profile@0.16.502) (2025-04-29)
11
+
12
+ **Note:** Version bump only for package @parca/profile
13
+
6
14
  ## [0.16.501](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.500...@parca/profile@0.16.501) (2025-04-29)
7
15
 
8
16
  **Note:** Version bump only for package @parca/profile
@@ -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;AAiB9E,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,KACvE,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAQD,KAAK,KAAK,GAAG,WAAW,GAAG;IACzB,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,CAAC;AAmeF,QAAA,MAAM,SAAS,gIAUZ,KAAK,KAAG,GAAG,CAAC,OAiCd,CAAC;AAEF,eAAe,SAAS,CAAC"}
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,KACvE,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAQD,KAAK,KAAK,GAAG,WAAW,GAAG;IACzB,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,CAAC;AA0dF,QAAA,MAAM,SAAS,gIAUZ,KAAK,KAAG,GAAG,CAAC,OAiCd,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -22,6 +22,7 @@ import { formatDate, formatForTimespan, getPrecision, valueFormatter } from '@pa
22
22
  import MetricsContextMenu from '../MetricsContextMenu';
23
23
  import MetricsTooltip from '../MetricsTooltip';
24
24
  import { useMetricsGraphDimensions } from '../useMetricsGraphDimensions';
25
+ import { getSeriesColor } from '../utils/colorMapping';
25
26
  function transformToSeries(data, isReceive = false) {
26
27
  const series = data.reduce(function (agg, s) {
27
28
  if (s.labelset !== undefined) {
@@ -120,10 +121,6 @@ const RawAreaChart = ({ transmitData, receiveData, addLabelMatcher, setTimeRange
120
121
  event: e,
121
122
  });
122
123
  }, [show]);
123
- const color = d3.scaleOrdinal(d3.schemeCategory10);
124
- const getSeriesColor = (series) => {
125
- return color(series.labelset);
126
- };
127
124
  // Create line generator for both transmit and receive
128
125
  const lineGenerator = d3
129
126
  .line()
@@ -229,13 +226,11 @@ const RawAreaChart = ({ transmitData, receiveData, addLabelMatcher, setTimeRange
229
226
  return false;
230
227
  });
231
228
  }
232
- const seriesColor = getSeriesColor(s);
233
- const strokeOpacity = isSelected ? 1 : 0.8;
234
- return (_jsx("g", { className: "line cursor-pointer", children: _jsx("path", { d: lineGenerator(s.values) ?? '', fill: "none", stroke: seriesColor, strokeWidth: isSelected
229
+ return (_jsx("g", { className: "line cursor-pointer", children: _jsx("path", { d: lineGenerator(s.values) ?? '', fill: "none", stroke: getSeriesColor(s.metric), strokeWidth: isSelected
235
230
  ? lineStrokeSelected
236
231
  : hovering && highlighted != null && i === highlighted.seriesIndex
237
232
  ? lineStrokeHover
238
- : lineStroke, strokeOpacity: strokeOpacity, onClick: () => {
233
+ : lineStroke, strokeOpacity: isSelected ? 1 : 0.8, onClick: () => {
239
234
  if (highlighted != null) {
240
235
  setSelectedSeries(JSON.stringify(highlighted.labels.map(l => ({
241
236
  key: l.name,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/MetricsGraph/UtilizationMetrics/index.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAC,aAAa,EAAqD,MAAM,mBAAmB,CAAC;AAKpG,OAAO,EAAC,KAAK,kBAAkB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AAE,YAAY,EAAE,CAAC;IACrB,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,KACvE,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAQD,KAAK,KAAK,GAAG,WAAW,GAAG;IACzB,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,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,KACvE,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,CAAC;AAkdF,QAAA,MAAM,kBAAkB,2GASrB,KAAK,KAAG,GAAG,CAAC,OAgCd,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -23,6 +23,7 @@ import MetricsSeries from '../../MetricsSeries';
23
23
  import MetricsContextMenu from '../MetricsContextMenu';
24
24
  import MetricsTooltip from '../MetricsTooltip';
25
25
  import { useMetricsGraphDimensions } from '../useMetricsGraphDimensions';
26
+ import { getSeriesColor } from '../utils/colorMapping';
26
27
  function transformToSeries(data) {
27
28
  const series = data.reduce(function (agg, s) {
28
29
  if (s.labelset !== undefined) {
@@ -126,7 +127,6 @@ const RawUtilizationMetrics = ({ data, addLabelMatcher, setTimeRange, width, hei
126
127
  event: e,
127
128
  });
128
129
  }, [show]);
129
- const color = d3.scaleOrdinal(d3.schemeCategory10);
130
130
  const l = d3.line(d => xScale(d[0]), d => yScale(d[1]));
131
131
  const highlighted = useMemo(() => {
132
132
  if (series.length === 0) {
@@ -229,7 +229,7 @@ const RawUtilizationMetrics = ({ data, addLabelMatcher, setTimeRange, width, hei
229
229
  return false;
230
230
  });
231
231
  }
232
- return (_jsx("g", { className: "line cursor-pointer", children: _jsx(MetricsSeries, { data: s, line: l, color: color(i.toString()), strokeWidth: isSelected
232
+ return (_jsx("g", { className: "line cursor-pointer", children: _jsx(MetricsSeries, { data: s, line: l, color: getSeriesColor(s.metric), strokeWidth: isSelected
233
233
  ? lineStrokeSelected
234
234
  : hovering && highlighted != null && i === highlighted.seriesIndex
235
235
  ? lineStrokeHover
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Generates a consistent color for a series based on its identifying properties
3
+ */
4
+ export declare function getSeriesColor(labels: Array<{
5
+ name: string;
6
+ value: string;
7
+ }>): string;
8
+ //# sourceMappingURL=colorMapping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorMapping.d.ts","sourceRoot":"","sources":["../../../src/MetricsGraph/utils/colorMapping.ts"],"names":[],"mappings":"AAqBA;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAAC,GAAG,MAAM,CAgBnF"}
@@ -0,0 +1,35 @@
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
+ import * as d3 from 'd3';
14
+ // Cache to store color mappings
15
+ const colorCache = new Map();
16
+ // Create a color scale using d3's category10 scheme
17
+ const colorScale = d3.scaleOrdinal(d3.schemeCategory10);
18
+ /**
19
+ * Generates a consistent color for a series based on its identifying properties
20
+ */
21
+ export function getSeriesColor(labels) {
22
+ // Create a key from all labels to ensure unique identification
23
+ const key = labels
24
+ .map(l => `${l.name}=${l.value}`)
25
+ .sort()
26
+ .join(',');
27
+ // Return cached color if exists
28
+ if (colorCache.has(key)) {
29
+ return colorCache.get(key);
30
+ }
31
+ // Generate new color and cache it
32
+ const color = colorScale(key);
33
+ colorCache.set(key, color);
34
+ return color;
35
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/MetricsGraphStrips/index.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAGvC,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AACnC,OAAO,EAAY,SAAS,EAAC,MAAM,aAAa,CAAC;AAEjD,UAAU,KAAK;IACb,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IACpB,iBAAiB,CAAC,EAAE;QAClB,MAAM,EAAE,QAAQ,CAAC;QACjB,MAAM,EAAE,SAAS,CAAC;KACnB,CAAC;IACF,mBAAmB,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,gBAAgB,cAAe,QAAQ,KAAG,MAmBtD,CAAC;AAaF,eAAO,MAAM,kBAAkB,2EAO5B,KAAK,KAAG,GAAG,CAAC,OAiEd,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/MetricsGraphStrips/index.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAGvC,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AACnC,OAAO,EAAY,SAAS,EAAC,MAAM,aAAa,CAAC;AAEjD,UAAU,KAAK;IACb,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IACpB,iBAAiB,CAAC,EAAE;QAClB,MAAM,EAAE,QAAQ,CAAC;QACjB,MAAM,EAAE,SAAS,CAAC;KACnB,CAAC;IACF,mBAAmB,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,gBAAgB,cAAe,QAAQ,KAAG,MAmBtD,CAAC;AAaF,eAAO,MAAM,kBAAkB,2EAO5B,KAAK,KAAG,GAAG,CAAC,OAgEd,CAAC"}
@@ -43,7 +43,6 @@ const getTimelineGuideHeight = (cpus, collapsedIndices) => {
43
43
  };
44
44
  export const MetricsGraphStrips = ({ cpus, data, selectedTimeframe, onSelectedTimeframe, width, bounds, }) => {
45
45
  const [collapsedIndices, setCollapsedIndices] = useState([]);
46
- // @ts-expect-error
47
46
  const color = d3.scaleOrdinal(d3.schemeObservable10);
48
47
  const valueBounds = d3.extent(data.flatMap(d => d.map(p => p.value)));
49
48
  return (_jsxs("div", { className: "flex flex-col gap-1 relative my-0 ml-[70px]", style: { width: width ?? '100%' }, children: [_jsx(TimelineGuide, { bounds: [BigInt(0), BigInt(bounds[1] - bounds[0])], width: width ?? 1468, height: getTimelineGuideHeight(cpus, collapsedIndices), margin: 1 }), cpus.map((cpu, i) => {
@@ -1 +1 @@
1
- {"version":3,"file":"MetricsGraphSection.d.ts","sourceRoot":"","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,WAAW,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C,aAAa,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAClD,KAAK,EAAE,KAAK,CAAC;IACb,qBAAqB,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,kBAAkB,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,kBAAkB,CAAC,EAAE,KAAK,CAAC;QACzB,IAAI,EAAE,MAAM,CAAC;QACb,iBAAiB,EAAE,MAAM,CAAC;QAC1B,IAAI,EAAE,sBAAsB,EAAE,CAAC;KAChC,CAAC,CAAC;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,EAClC,gBAAgB,EAChB,gCAAgC,EAChC,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,KAAK,EACL,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,aAAa,EACb,KAAK,EACL,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,GAC1B,EAAE,wBAAwB,GAAG,GAAG,CAAC,OAAO,CAgMxC"}
@@ -88,7 +88,9 @@ export function MetricsGraphSection({ showMetricsGraph, setDisplayHideMetricsGra
88
88
  return (_jsx(_Fragment, { children: _jsx(UtilizationMetricsGraph, { data: data, addLabelMatcher: addLabelMatcher, setTimeRange: handleTimeRangeChange, utilizationMetricsLoading: utilizationMetricsLoading, name: name, humanReadableName: humanReadableName, from: querySelection.from, to: querySelection.to }, name) }));
89
89
  }
90
90
  return null;
91
- }), throughputMetrics.length > 0 && (_jsx(AreaChart, { transmitData: throughputMetrics[0].data, receiveData: throughputMetrics[1].data, addLabelMatcher: addLabelMatcher, setTimeRange: handleTimeRangeChange, name: throughputMetrics[0].name, humanReadableName: throughputMetrics[0].humanReadableName, from: querySelection.from, to: querySelection.to, utilizationMetricsLoading: utilizationMetricsLoading }))] }));
91
+ }), throughputMetrics.length > 0 && (_jsx(AreaChart, { transmitData: throughputMetrics.find(metric => metric.name === 'gpu_pcie_throughput_transmit_bytes')
92
+ ?.data ?? [], receiveData: throughputMetrics.find(metric => metric.name === 'gpu_pcie_throughput_receive_bytes')
93
+ ?.data ?? [], addLabelMatcher: addLabelMatcher, setTimeRange: handleTimeRangeChange, name: throughputMetrics[0].name, humanReadableName: throughputMetrics[0].humanReadableName, from: querySelection.from, to: querySelection.to, utilizationMetricsLoading: utilizationMetricsLoading }))] }));
92
94
  };
93
95
  return (_jsxs("div", { className: cx('relative', { 'py-4': !showMetricsGraph }), children: [setDisplayHideMetricsGraphButton != null ? (_jsxs("button", { onClick: () => setDisplayHideMetricsGraphButton(!showMetricsGraph), className: cx('hidden px-3 py-1 text-sm font-medium text-gray-700 dark:text-gray-200 bg-gray-100 rounded-md hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:bg-gray-900 z-10', showMetricsGraph && 'absolute right-0 bottom-3 !flex', !showMetricsGraph && 'relative !flex ml-auto'), children: [showMetricsGraph ? 'Hide' : 'Show', " Metrics Graph"] })) : null, showMetricsGraph && (_jsx(_Fragment, { children: _jsx("div", { style: { height: heightStyle }, children: querySelection.expression !== '' &&
94
96
  querySelection.from !== undefined &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.16.501",
3
+ "version": "0.16.503",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@headlessui/react": "^1.7.19",
@@ -77,5 +77,5 @@
77
77
  "access": "public",
78
78
  "registry": "https://registry.npmjs.org/"
79
79
  },
80
- "gitHead": "c4e8f04f288c83601e5ade7a94e595ac2f07fc4e"
80
+ "gitHead": "d819176089991f04be81ea484dc04c6d09001d05"
81
81
  }
@@ -27,6 +27,7 @@ import {type UtilizationMetrics as MetricSeries} from '../../ProfileSelector';
27
27
  import MetricsContextMenu from '../MetricsContextMenu';
28
28
  import MetricsTooltip from '../MetricsTooltip';
29
29
  import {useMetricsGraphDimensions} from '../useMetricsGraphDimensions';
30
+ import {getSeriesColor} from '../utils/colorMapping';
30
31
 
31
32
  interface NetworkLabel {
32
33
  name: string;
@@ -207,12 +208,6 @@ const RawAreaChart = ({
207
208
  [show]
208
209
  );
209
210
 
210
- const color = d3.scaleOrdinal(d3.schemeCategory10);
211
-
212
- const getSeriesColor = (series: NetworkSeries): string => {
213
- return color(series.labelset);
214
- };
215
-
216
211
  // Create line generator for both transmit and receive
217
212
  const lineGenerator = d3
218
213
  .line<number[]>()
@@ -502,15 +497,12 @@ const RawAreaChart = ({
502
497
  });
503
498
  }
504
499
 
505
- const seriesColor = getSeriesColor(s);
506
- const strokeOpacity = isSelected ? 1 : 0.8;
507
-
508
500
  return (
509
501
  <g key={i} className="line cursor-pointer">
510
502
  <path
511
503
  d={lineGenerator(s.values) ?? ''}
512
504
  fill="none"
513
- stroke={seriesColor}
505
+ stroke={getSeriesColor(s.metric)}
514
506
  strokeWidth={
515
507
  isSelected
516
508
  ? lineStrokeSelected
@@ -518,7 +510,7 @@ const RawAreaChart = ({
518
510
  ? lineStrokeHover
519
511
  : lineStroke
520
512
  }
521
- strokeOpacity={strokeOpacity}
513
+ strokeOpacity={isSelected ? 1 : 0.8}
522
514
  onClick={() => {
523
515
  if (highlighted != null) {
524
516
  setSelectedSeries(
@@ -29,6 +29,7 @@ import MetricsContextMenu from '../MetricsContextMenu';
29
29
  import MetricsTooltip from '../MetricsTooltip';
30
30
  import {type Series} from '../index';
31
31
  import {useMetricsGraphDimensions} from '../useMetricsGraphDimensions';
32
+ import {getSeriesColor} from '../utils/colorMapping';
32
33
 
33
34
  interface CommonProps {
34
35
  data: MetricSeries[];
@@ -203,8 +204,6 @@ const RawUtilizationMetrics = ({
203
204
  [show]
204
205
  );
205
206
 
206
- const color = d3.scaleOrdinal(d3.schemeCategory10);
207
-
208
207
  const l = d3.line(
209
208
  d => xScale(d[0]),
210
209
  d => yScale(d[1])
@@ -487,7 +486,7 @@ const RawUtilizationMetrics = ({
487
486
  <MetricsSeries
488
487
  data={s}
489
488
  line={l}
490
- color={color(i.toString())}
489
+ color={getSeriesColor(s.metric)}
491
490
  strokeWidth={
492
491
  isSelected
493
492
  ? lineStrokeSelected
@@ -0,0 +1,41 @@
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 * as d3 from 'd3';
15
+
16
+ // Cache to store color mappings
17
+ const colorCache = new Map<string, string>();
18
+
19
+ // Create a color scale using d3's category10 scheme
20
+ const colorScale = d3.scaleOrdinal(d3.schemeCategory10);
21
+
22
+ /**
23
+ * Generates a consistent color for a series based on its identifying properties
24
+ */
25
+ export function getSeriesColor(labels: Array<{name: string; value: string}>): string {
26
+ // Create a key from all labels to ensure unique identification
27
+ const key = labels
28
+ .map(l => `${l.name}=${l.value}`)
29
+ .sort()
30
+ .join(',');
31
+
32
+ // Return cached color if exists
33
+ if (colorCache.has(key)) {
34
+ return colorCache.get(key)!;
35
+ }
36
+
37
+ // Generate new color and cache it
38
+ const color = colorScale(key);
39
+ colorCache.set(key, color);
40
+ return color;
41
+ }
@@ -78,7 +78,6 @@ export const MetricsGraphStrips = ({
78
78
  }: Props): JSX.Element => {
79
79
  const [collapsedIndices, setCollapsedIndices] = useState<number[]>([]);
80
80
 
81
- // @ts-expect-error
82
81
  const color = d3.scaleOrdinal(d3.schemeObservable10);
83
82
 
84
83
  const valueBounds = d3.extent(data.flatMap(d => d.map(p => p.value))) as [number, number];
@@ -127,7 +126,7 @@ export const MetricsGraphStrips = ({
127
126
  data={data[i]}
128
127
  height={STRIP_HEIGHT}
129
128
  width={width ?? 1468}
130
- fill={color(labelStr) as string}
129
+ fill={color(labelStr)}
131
130
  selectionBounds={isSelected ? selectedTimeframe?.bounds : undefined}
132
131
  setSelectionBounds={bounds => {
133
132
  onSelectedTimeframe(cpu, bounds);
@@ -184,8 +184,14 @@ export function MetricsGraphSection({
184
184
  })}
185
185
  {throughputMetrics.length > 0 && (
186
186
  <AreaChart
187
- transmitData={throughputMetrics[0].data}
188
- receiveData={throughputMetrics[1].data}
187
+ transmitData={
188
+ throughputMetrics.find(metric => metric.name === 'gpu_pcie_throughput_transmit_bytes')
189
+ ?.data ?? []
190
+ }
191
+ receiveData={
192
+ throughputMetrics.find(metric => metric.name === 'gpu_pcie_throughput_receive_bytes')
193
+ ?.data ?? []
194
+ }
189
195
  addLabelMatcher={addLabelMatcher}
190
196
  setTimeRange={handleTimeRangeChange}
191
197
  name={throughputMetrics[0].name}