forked from linkerd/linkerd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TopRoutesTable.jsx
87 lines (83 loc) · 2.24 KB
/
TopRoutesTable.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import { metricToFormatter, numericSort } from './util/Utils.js';
import BaseTable from './BaseTable.jsx';
import { DefaultRoute } from './util/MetricUtils.jsx';
import PropTypes from 'prop-types';
import React from 'react';
import SuccessRateMiniChart from './util/SuccessRateMiniChart.jsx';
const routesColumns = [
{
title: "Route",
dataIndex: "route",
sorter: (a, b) => {
if (a.route === DefaultRoute) {
return 1;
} else {
if (b.route === DefaultRoute) {
return -1;
}
}
return (a.route).localeCompare(b.route);
}
},
{
title: "Authority",
tooltip: "hostname:port used when communicating with this target",
dataIndex: "authority",
sorter: (a, b) => (a.authority).localeCompare(b.authority)
},
{
title: "Success Rate",
dataIndex: "successRate",
isNumeric: true,
render: d => <SuccessRateMiniChart sr={d.successRate} />,
sorter: (a, b) => numericSort(a.successRate, b.successRate)
},
{
title: "RPS",
dataIndex: "requestRate",
isNumeric: true,
render: d => metricToFormatter["NO_UNIT"](d.requestRate),
sorter: (a, b) => numericSort(a.requestRate, b.requestRate)
},
{
title: "P50 Latency",
dataIndex: "latency.P50",
isNumeric: true,
render: d => metricToFormatter["LATENCY"](d.latency.P50),
sorter: (a, b) => numericSort(a.P50, b.P50)
},
{
title: "P95 Latency",
dataIndex: "latency.P95",
isNumeric: true,
render: d => metricToFormatter["LATENCY"](d.latency.P95),
sorter: (a, b) => numericSort(a.P95, b.P95)
},
{
title: "P99 Latency",
dataIndex: "latency.P99",
isNumeric: true,
render: d => metricToFormatter["LATENCY"](d.latency.P99),
sorter: (a, b) => numericSort(a.latency.P99, b.latency.P99)
}
];
export default class TopRoutesTable extends React.Component {
static propTypes = {
rows: PropTypes.arrayOf(PropTypes.shape({}))
};
static defaultProps = {
rows: []
};
render() {
const { rows } = this.props;
return (
<BaseTable
tableRows={rows}
tableColumns={routesColumns}
tableClassName="metric-table"
defaultOrderBy="route"
rowKey={r => r.route + r.authority}
padding="dense" />
);
}
}