Skip to content

Commit b2c9fae

Browse files
authored
Merge pull request #19587 from GordonSmith/HPCC-30603-METRICS_HIGHLIGHT_ISSUES
HPCC-30603 Highlight activites with warnings Reviewed-By: Jeremy Clements <jeremy.clements@lexisnexisrisk.com> Merged-by: Gavin Halliday <ghalliday@hpccsystems.com>
2 parents 8a85336 + 661ce36 commit b2c9fae

File tree

4 files changed

+171
-89
lines changed

4 files changed

+171
-89
lines changed

esp/src/src-react/components/MetricsPropertiesTables.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import * as React from "react";
22
import { useConst } from "@fluentui/react-hooks";
33
import { Palette } from "@hpcc-js/common";
4-
import { IScope } from "@hpcc-js/comms";
54
import { ColumnFormat, Table } from "@hpcc-js/dgrid";
65
import { formatDecimal } from "src/Utility";
6+
import { formatTwoDigits } from "src/Session";
77
import nlsHPCC from "src/nlsHPCC";
8+
import { IScopeEx } from "../hooks/metrics";
89
import { AutosizeHpccJSComponent } from "../layouts/HpccJSAdapter";
910

1011
Palette.rainbow("StdDevs", ["white", "white", "#fff0f0", "#ffC0C0", "#ff8080", "#ff0000", "#ff0000"]);
1112

1213
export interface MetricsPropertiesTablesProps {
1314
scopesTableColumns?: string[];
14-
scopes?: IScope[];
15+
scopes?: IScopeEx[];
1516
}
1617

1718
export const MetricsPropertiesTables: React.FunctionComponent<MetricsPropertiesTablesProps> = ({
@@ -44,6 +45,9 @@ export const MetricsPropertiesTables: React.FunctionComponent<MetricsPropertiesT
4445
const props = [];
4546
scopes.forEach((item, idx) => {
4647
const scopeProps = [];
48+
for (const exception of item.__exceptions ?? []) {
49+
scopeProps.push([exception.Severity, exception.Message, `${formatTwoDigits(+exception.Priority / 1000)}s`, "", "", "", "", "", "", "", "", 6]);
50+
}
4751
for (const key in item.__groupedProps) {
4852
const row = item.__groupedProps[key];
4953
scopeProps.push([row.Key, row.Value, row.Avg, row.Min, row.Max, row.Delta, row.StdDev === undefined ? "" : `${row.StdDev} (${formatDecimal(row.StdDevs)}σ)`, row.SkewMin, row.SkewMax, row.NodeMin, row.NodeMax, row.StdDevs]);

esp/src/src-react/hooks/metrics.ts

+53-31
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,18 @@ export interface useMetricsResult {
263263
refresh: () => void;
264264
}
265265

266+
export interface IScopeEx extends IScope {
267+
__exceptions?: WsWorkunits.ECLException[],
268+
}
269+
266270
export function useWorkunitMetrics(
267271
wuid: string,
268272
scopeFilter: Partial<WsWorkunits.ScopeFilter> = scopeFilterDefault,
269273
nestedFilter: WsWorkunits.NestedFilter = nestedFilterDefault
270274
): useMetricsResult {
271275

272276
const [workunit, state] = useWorkunit(wuid);
273-
const [data, setData] = React.useState<IScope[]>([]);
277+
const [data, setData] = React.useState<IScopeEx[]>([]);
274278
const [columns, setColumns] = React.useState<{ [id: string]: any }>([]);
275279
const [activities, setActivities] = React.useState<WsWorkunits.Activity2[]>([]);
276280
const [properties, setProperties] = React.useState<WsWorkunits.Property2[]>([]);
@@ -281,40 +285,58 @@ export function useWorkunitMetrics(
281285

282286
React.useEffect(() => {
283287
if (wuid && workunit) {
288+
const fetchInfo = singletonDebounce(workunit, "fetchInfo");
284289
const fetchDetailsNormalized = singletonDebounce(workunit, "fetchDetailsNormalized");
285290
setStatus(FetchStatus.STARTED);
286-
fetchDetailsNormalized({
287-
ScopeFilter: scopeFilter,
288-
NestedFilter: nestedFilter,
289-
PropertiesToReturn: {
290-
AllScopes: true,
291-
AllAttributes: true,
292-
AllProperties: true,
293-
AllNotes: true,
294-
AllStatistics: true,
295-
AllHints: true
296-
},
297-
ScopeOptions: {
298-
IncludeId: true,
299-
IncludeScope: true,
300-
IncludeScopeType: true,
301-
IncludeMatchedScopesInResults: true
302-
},
303-
PropertyOptions: {
304-
IncludeName: true,
305-
IncludeRawValue: true,
306-
IncludeFormatted: true,
307-
IncludeMeasure: true,
308-
IncludeCreator: false,
309-
IncludeCreatorType: false
291+
Promise.all([
292+
fetchInfo({ IncludeExceptions: true }),
293+
fetchDetailsNormalized({
294+
ScopeFilter: scopeFilter,
295+
NestedFilter: nestedFilter,
296+
PropertiesToReturn: {
297+
AllScopes: true,
298+
AllAttributes: true,
299+
AllProperties: true,
300+
AllNotes: true,
301+
AllStatistics: true,
302+
AllHints: true
303+
},
304+
ScopeOptions: {
305+
IncludeId: true,
306+
IncludeScope: true,
307+
IncludeScopeType: true,
308+
IncludeMatchedScopesInResults: true
309+
},
310+
PropertyOptions: {
311+
IncludeName: true,
312+
IncludeRawValue: true,
313+
IncludeFormatted: true,
314+
IncludeMeasure: true,
315+
IncludeCreator: false,
316+
IncludeCreatorType: false
317+
}
318+
})
319+
]).then(([info, response]) => {
320+
const exceptionsMap: { [scope: string]: WsWorkunits.ECLException[] } = {};
321+
for (const exception of info?.Workunit?.Exceptions?.ECLException ?? []) {
322+
if (exception.Scope) {
323+
if (!exceptionsMap[exception.Scope]) {
324+
exceptionsMap[exception.Scope] = [];
325+
}
326+
exceptionsMap[exception.Scope].push(exception);
327+
}
310328
}
311-
}).then(response => {
312-
setData(response?.data);
329+
setData(response?.data.map(row => {
330+
if (exceptionsMap[row.name]) {
331+
row.__exceptions = exceptionsMap[row.name];
332+
}
333+
return row;
334+
}));
313335
setColumns(response?.columns);
314-
setActivities(response?.meta?.Activities?.Activity || []);
315-
setProperties(response?.meta?.Properties?.Property || []);
316-
setMeasures(response?.meta?.Measures?.Measure || []);
317-
setScopeTypes(response?.meta?.ScopeTypes?.ScopeType || []);
336+
setActivities(response?.meta?.Activities?.Activity ?? []);
337+
setProperties(response?.meta?.Properties?.Property ?? []);
338+
setMeasures(response?.meta?.Measures?.Measure ?? []);
339+
setScopeTypes(response?.meta?.ScopeTypes?.ScopeType ?? []);
318340
}).catch(e => {
319341
logger.error(e);
320342
}).finally(() => {
+37-18
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,81 @@
1+
.eclwatch_MetricGraphWidget {
2+
/* fill: var(--colorNeutralBackground1); */
3+
background-color: red;
4+
stroke: var(--colorNeutralForeground1);
5+
}
6+
7+
.eclwatch_MetricGraphWidget rect.zoomBackground {
8+
fill: var(--colorNeutralBackground1);
9+
stroke: none;
10+
}
11+
12+
.eclwatch_MetricGraphWidget text {
13+
fill: var(--colorNeutralForeground1);
14+
stroke: none;
15+
}
16+
117
.eclwatch_MetricGraphWidget .cluster>polygon {
2-
stroke: darkgray;
18+
stroke: var(--colorPalettePlatinumForeground2);
319
}
420

521
.eclwatch_MetricGraphWidget .cluster.started>polygon {
6-
stroke: darkorange;
22+
stroke: var(--colorStatusWarningForeground1);
723
}
824

925
.eclwatch_MetricGraphWidget .cluster.completed>polygon {
10-
stroke: darkgreen;
26+
stroke: var(--colorStatusSuccessForeground1);
1127
}
1228

1329
.eclwatch_MetricGraphWidget .node>path {
14-
stroke: darkgray;
30+
stroke: var(--colorPalettePlatinumForeground2);
1531
}
1632

1733
.eclwatch_MetricGraphWidget .node>polygon {
18-
stroke: darkgray;
34+
stroke: var(--colorPalettePlatinumForeground2);
1935
}
2036

2137
.eclwatch_MetricGraphWidget .node.started>path {
22-
stroke: darkorange;
38+
stroke: var(--colorStatusWarningForeground1);
2339
}
2440

2541
.eclwatch_MetricGraphWidget .node.started>polygon {
26-
stroke: darkorange;
42+
stroke: var(--colorStatusWarningForeground1);
2743
}
2844

2945
.eclwatch_MetricGraphWidget .node.completed>path {
30-
stroke: darkgreen;
46+
stroke: var(--colorStatusSuccessForeground1);
3147
}
3248

3349
.eclwatch_MetricGraphWidget .node.completed>polygon {
34-
stroke: darkgreen;
50+
stroke: var(--colorStatusSuccessForeground1);
51+
}
52+
53+
.eclwatch_MetricGraphWidget .node.warning>text.warning {
54+
font-size: 32px;
55+
fill: var(--colorStatusWarningForeground1);
56+
stroke-width: 0px;
3557
}
3658

3759
.eclwatch_MetricGraphWidget .edge>path {
38-
stroke: darkgray;
60+
stroke: var(--colorPalettePlatinumForeground2);
3961
}
4062

4163
.eclwatch_MetricGraphWidget .edge>polygon {
42-
stroke: darkgray;
43-
fill: darkgray;
64+
stroke: var(--colorPalettePlatinumForeground2);
4465
}
4566

4667
.eclwatch_MetricGraphWidget .edge.started>path {
47-
stroke: darkorange;
68+
stroke: var(--colorStatusWarningForeground1);
4869
}
4970

5071
.eclwatch_MetricGraphWidget .edge.started>polygon {
51-
stroke: darkorange;
52-
fill: darkorange;
72+
stroke: var(--colorStatusWarningForeground1);
5373
}
5474

5575
.eclwatch_MetricGraphWidget .edge.completed>path {
56-
stroke: darkgreen;
76+
stroke: var(--colorStatusSuccessForeground1);
5777
}
5878

5979
.eclwatch_MetricGraphWidget .edge.completed>polygon {
60-
stroke: darkgreen;
61-
fill: darkgreen;
80+
stroke: var(--colorStatusSuccessForeground1);
6281
}

0 commit comments

Comments
 (0)