Skip to content

Commit a6653b4

Browse files
authored
Merge pull request #493 from tapdata/feat/TAP-9218-qps-95-99
Feat/tap 9218 qps 95 99
2 parents 804235b + 9fa52d7 commit a6653b4

7 files changed

Lines changed: 216 additions & 34 deletions

File tree

packages/component/src/TimeSelect.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ export default {
244244
return
245245
}
246246
this.period = value
247+
248+
return findOne
247249
},
248250
249251
getPeriod(value) {
@@ -341,7 +343,7 @@ export default {
341343
}
342344
343345
.picker__item {
344-
padding: 0 8px;
346+
padding-right: 8px;
345347
border-radius: 4px;
346348
347349
//&:hover {

packages/dag/src/components/monitor/LeftSider.vue

Lines changed: 170 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import dayjs from 'dayjs'
1313
import { cloneDeep } from 'lodash-es'
1414
import { mapGetters } from 'vuex'
1515
import { $emit } from '../../../utils/gogocodeTransfer'
16-
import Frequency from './components/Frequency'
17-
import InitialList from './components/InitialList'
18-
import LineChart from './components/LineChart'
16+
import Frequency from './components/Frequency.vue'
17+
import InitialList from './components/InitialList.vue'
18+
import LineChart from './components/LineChart.vue'
1919
2020
export default {
2121
name: 'LeftSider',
@@ -128,6 +128,17 @@ export default {
128128
},
129129
],
130130
},
131+
qpsColors: [
132+
'#5470c6',
133+
'#91cc75',
134+
'#fac858',
135+
'#ee6666',
136+
'#73c0de',
137+
'#3ba272',
138+
'#fc8452',
139+
'#9a60b4',
140+
'#ea7ccc',
141+
],
131142
}
132143
},
133144
computed: {
@@ -154,6 +165,15 @@ export default {
154165
const outputQps = data.outputQps?.map(Math.abs)
155166
const inputSizeQps = data.inputSizeQps?.map(Math.abs)
156167
const outputSizeQps = data.outputSizeQps?.map(Math.abs)
168+
const inputQps95th = data.inputQps95th
169+
const inputQps99th = data.inputQps99th
170+
const outputQps95th = data.outputQps95th
171+
const outputQps99th = data.outputQps99th
172+
const inputSizeQps95th = data.inputSizeQps95th
173+
const inputSizeQps99th = data.inputSizeQps99th
174+
const outputSizeQps95th = data.outputSizeQps95th
175+
const outputSizeQps99th = data.outputSizeQps99th
176+
157177
// 计算距离增量时间点,最近的时间点
158178
const milestone = this.dataflow.attrs?.milestone || {}
159179
const snapshotDoneAt = milestone.SNAPSHOT?.end
@@ -167,8 +187,6 @@ export default {
167187
}
168188
})
169189
170-
const countValues = [inputQps, outputQps]
171-
const sizeValues = [inputSizeQps, outputSizeQps]
172190
let unit = '5s'
173191
174192
switch (interval) {
@@ -185,11 +203,51 @@ export default {
185203
unit = 'd'
186204
break
187205
}
188-
const name = [
206+
207+
const countNames = [
189208
i18n.t('public_time_avg_input', { unit }),
190209
i18n.t('public_time_avg_output', { unit }),
191210
]
192211
212+
const sizeNames = [
213+
i18n.t('public_time_avg_input', { unit }),
214+
i18n.t('public_time_avg_output', { unit }),
215+
]
216+
217+
const countValues = [inputQps, outputQps]
218+
const countP95Values = [
219+
inputQps95th,
220+
outputQps95th,
221+
inputQps99th,
222+
outputQps99th,
223+
]
224+
const sizeValues = [inputSizeQps, outputSizeQps]
225+
const sizeP95Values = [
226+
inputSizeQps95th,
227+
outputSizeQps95th,
228+
inputSizeQps99th,
229+
outputSizeQps99th,
230+
]
231+
const p95Names = [
232+
i18n.t('public_time_avg_input_95th'),
233+
i18n.t('public_time_avg_output_95th'),
234+
i18n.t('public_time_avg_input_99th'),
235+
i18n.t('public_time_avg_output_99th'),
236+
]
237+
238+
countP95Values.forEach((values, i) => {
239+
if (values?.some((v) => v !== null)) {
240+
countValues.push(values)
241+
countNames.push(p95Names[i])
242+
}
243+
})
244+
sizeP95Values.forEach((values, i) => {
245+
if (values?.some((v) => v !== null)) {
246+
sizeValues.push(values)
247+
sizeNames.push(p95Names[i])
248+
}
249+
})
250+
193251
if (interval > 5000) {
194252
countValues.push(
195253
data.maxInputQps?.map(Math.abs),
@@ -199,17 +257,24 @@ export default {
199257
data.maxInputSizeQps?.map(Math.abs),
200258
data.maxOutputSizeQps?.map(Math.abs),
201259
)
202-
name.push(
260+
const names = [
203261
i18n.t('public_time_max_input', { unit }),
204262
i18n.t('public_time_max_output', { unit }),
205-
)
263+
]
264+
countNames.push(...names)
265+
sizeNames.push(...names)
206266
}
207267
208268
const opt = {
209269
x: time,
210-
name,
211270
value: [],
212271
zoomValue: 10,
272+
serieOptions: Array.from({ length: 8 }).fill(
273+
{
274+
areaStyle: undefined,
275+
},
276+
2,
277+
),
213278
}
214279
215280
if (this.dataflow.type === 'initial_sync+cdc') {
@@ -234,9 +299,11 @@ export default {
234299
return {
235300
count: Object.assign(cloneDeep(opt), {
236301
value: countValues,
302+
name: countNames,
237303
}),
238304
size: Object.assign(cloneDeep(opt), {
239305
value: sizeValues,
306+
name: sizeNames,
240307
}),
241308
}
242309
},
@@ -267,7 +334,8 @@ export default {
267334
}
268335
}
269336
270-
const { replicateLag = [] } = data
337+
const name = [i18n.t('public_event_incremental_delay')]
338+
const { replicateLag = [], replicateLag95th, replicateLag99th } = data
271339
const open = this.dataflow.alarmSettings?.find(
272340
(t) => t.key === 'TASK_INCREMENT_DELAY',
273341
)?.open
@@ -277,10 +345,26 @@ export default {
277345
)?.ms || 0
278346
: 60 * 1000
279347
const max = Math.max(...replicateLag)
348+
const value = [replicateLag]
349+
if (replicateLag95th?.some((v) => v !== null)) {
350+
value.push(replicateLag95th)
351+
name.push(i18n.t('public_event_incremental_delay_95th'))
352+
}
353+
if (replicateLag99th?.some((v) => v !== null)) {
354+
value.push(replicateLag99th)
355+
name.push(i18n.t('public_event_incremental_delay_99th'))
356+
}
280357
return {
281358
x: time,
282-
value: replicateLag,
359+
name,
360+
value,
283361
yAxisMax: Math.max(delay, max),
362+
serieOptions: Array.from({ length: 3 }).fill(
363+
{
364+
areaStyle: undefined,
365+
},
366+
1,
367+
),
284368
}
285369
},
286370
@@ -475,7 +559,14 @@ export default {
475559
methods: {
476560
changeTimeSelect(val, isTime, source) {
477561
this.$emit('changeTimeSelect', val, isTime, source)
478-
this.timeSelectLabel = this.$refs.timeSelect?.getPeriod()?.label
562+
// this.timeSelectLabel = this.$refs.timeSelect?.getPeriod()?.label
563+
564+
this.isUpdatingTimeSelect = true
565+
this.$refs.dialogTimeSelect?.setPeriod(val)
566+
567+
setTimeout(() => {
568+
this.isUpdatingTimeSelect = false
569+
}, 10)
479570
},
480571
481572
changeFrequency(val) {
@@ -634,6 +725,17 @@ export default {
634725
}
635726
map[this.$route.name]?.(this.dataflow.id)
636727
},
728+
729+
onChangeDialogTimeSelect(val, isTime, source) {
730+
if (this.isUpdatingTimeSelect) {
731+
return
732+
}
733+
const selected = this.$refs.timeSelect?.setPeriod(val)
734+
735+
if (selected) {
736+
this.$emit('changeTimeSelect', val, isTime, source)
737+
}
738+
},
637739
},
638740
emits: ['load-data', 'verifyDetails', 'changeTimeSelect', 'changeFrequency'],
639741
}
@@ -936,7 +1038,7 @@ export default {
9361038
9371039
<LineChart
9381040
:data="qpsMap[qpsChartsType]"
939-
:color="['#26CF6C', '#2C65FF', '#b6d634', '#5070dd']"
1041+
:color="qpsColors"
9401042
:time-format="timeFormat"
9411043
:label-unit-type="qpsChartsType === 'size' ? 'byte' : ''"
9421044
auto-scale
@@ -973,7 +1075,7 @@ export default {
9731075
9741076
<LineChart
9751077
:data="replicateLagData"
976-
:color="['#2C65FF']"
1078+
:color="['#2C65FF', '#91cc75', '#fac858']"
9771079
:time-format="timeFormat"
9781080
time-value
9791081
class="line-chart"
@@ -1110,11 +1212,24 @@ export default {
11101212
11111213
<ElDialog
11121214
v-model="lineChartDialog"
1113-
:title="$t('packages_dag_components_nodedetaildialog_xingnengzhibiao')"
11141215
width="774px"
11151216
:close-on-click-modal="false"
11161217
:modal-append-to-body="false"
11171218
>
1219+
<template #header="{ titleClass }">
1220+
<div class="flex align-center gap-3">
1221+
<span :class="titleClass">{{
1222+
$t('packages_dag_components_nodedetaildialog_xingnengzhibiao')
1223+
}}</span>
1224+
<el-divider class="mx-0" direction="vertical" />
1225+
<TimeSelect
1226+
ref="dialogTimeSelect"
1227+
:options="timeOptions"
1228+
:range="$attrs.range"
1229+
@change="onChangeDialogTimeSelect"
1230+
/>
1231+
</div>
1232+
</template>
11181233
<div class="line-chart__box mb-2">
11191234
<div class="flex justify-content-between">
11201235
<ElTooltip
@@ -1131,36 +1246,66 @@ export default {
11311246
<VIcon size="16" class="color-primary">info</VIcon>
11321247
</span>
11331248
</ElTooltip>
1134-
<ElRadioGroup v-model="qpsChartsType" class="chart__radio">
1135-
<ElRadioButton label="count">count</ElRadioButton>
1136-
<ElRadioButton label="size">size</ElRadioButton>
1137-
</ElRadioGroup>
1249+
<el-segmented v-model="qpsChartsType" :options="['count', 'size']" />
11381250
</div>
11391251
</div>
11401252
11411253
<LineChart
11421254
:data="qpsMap[qpsChartsType]"
1143-
:color="['#26CF6C', '#2C65FF']"
1255+
:color="qpsColors"
11441256
:time-format="timeFormat"
11451257
:label-unit-type="qpsChartsType === 'size' ? 'byte' : ''"
1258+
:options="{
1259+
legend: {
1260+
show: true,
1261+
type: 'scroll',
1262+
bottom: 0,
1263+
},
1264+
grid: {
1265+
outerBounds: {
1266+
left: 0,
1267+
top: 0,
1268+
right: 10,
1269+
bottom: 32,
1270+
},
1271+
},
1272+
}"
11461273
style="height: 200px"
11471274
/>
1275+
1276+
<div class="mt-4 font-color-dark fw-bold mb-2 lh-8">
1277+
{{ $t('public_event_incremental_delay') }}
1278+
</div>
11481279
<LineChart
11491280
:data="replicateLagData"
1150-
:title="$t('public_event_incremental_delay')"
1151-
:color="['#2C65FF']"
1281+
:color="['#2C65FF', '#91cc75', '#fac858']"
11521282
:time-format="timeFormat"
11531283
time-value
1154-
class="mt-8"
11551284
style="height: 200px"
1285+
:options="{
1286+
legend: {
1287+
show: true,
1288+
type: 'scroll',
1289+
bottom: 0,
1290+
},
1291+
grid: {
1292+
outerBounds: {
1293+
left: 0,
1294+
top: 0,
1295+
right: 10,
1296+
bottom: 32,
1297+
},
1298+
},
1299+
}"
11561300
/>
1301+
<div class="mt-4 font-color-dark fw-bold mb-2 lh-8">
1302+
{{ $t('packages_dag_monitor_leftsider_chulihaoshim') }}
1303+
</div>
11571304
<LineChart
11581305
:data="delayData"
1159-
:title="$t('packages_dag_monitor_leftsider_chulihaoshim')"
11601306
:color="['#2C65FF']"
11611307
:time-format="timeFormat"
11621308
time-value
1163-
class="mt-8"
11641309
style="height: 200px"
11651310
/>
11661311
</ElDialog>

packages/dag/src/components/monitor/components/Frequency.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export default {
136136
}
137137
138138
.picker__item {
139-
padding: 0 8px;
139+
padding-right: 8px;
140140
border-radius: 4px;
141141
}
142142
</style>

0 commit comments

Comments
 (0)