diff --git a/web/src/pages/Monitor/Strategy/SettingFields/Expressions/Expression.tsx b/web/src/pages/Monitor/Strategy/SettingFields/Expressions/Expression.tsx index c010d49b..5257de60 100644 --- a/web/src/pages/Monitor/Strategy/SettingFields/Expressions/Expression.tsx +++ b/web/src/pages/Monitor/Strategy/SettingFields/Expressions/Expression.tsx @@ -119,6 +119,7 @@ class Expression extends Component { ); + let nPostfix = str.substring(index1 + 2); if (index2 > -1) { const mPrefix = str.substring(index1 + 2, index2); previewNode = ( @@ -128,9 +129,10 @@ class Expression extends Component { {m} ); + nPostfix = str.substring(index2 + 2); } - if (func !== 'nodata') { + if (func !== 'nodata' && func !== 'stddev') { // eslint-disable-next-line no-underscore-dangle const _index = index2 > -1 ? index2 : index1; const vPrefix = str.substring(_index + 2, index3); @@ -143,7 +145,7 @@ class Expression extends Component { ); } else { - const nPostfix = str.substring(index1 + 2); + // const nPostfix = str.substring(index1 + 2); previewNode = ( {previewNode} @@ -187,7 +189,7 @@ class Expression extends Component { ); } - if (func === 'happen' || func === 'ndiff') { + if (func === 'happen' || func === 'ndiff' || func === 'stddev') { // 发生次数 return ( { this.handleParamsChange(i, newVal); }} /> ); @@ -218,7 +220,7 @@ class Expression extends Component { _.map(_.get(funcMap[value.func], 'params', []), (o, i) => { return (
- {o} + {o} : { this.renderFuncParams(i) }
@@ -227,7 +229,7 @@ class Expression extends Component { } { // render value - value.func !== 'nodata' && // nodata 不需要填值 + value.func !== 'nodata' && value.func !== 'stddev' && // nodata 不需要填值
v diff --git a/web/src/pages/Monitor/Strategy/SettingFields/Expressions/config.tsx b/web/src/pages/Monitor/Strategy/SettingFields/Expressions/config.tsx index 62882bfe..2d34aebb 100644 --- a/web/src/pages/Monitor/Strategy/SettingFields/Expressions/config.tsx +++ b/web/src/pages/Monitor/Strategy/SettingFields/Expressions/config.tsx @@ -64,6 +64,13 @@ export const funcMap = { params: [], defaultValue: [], }, + stddev: { + label: '3-sigma离群点检测', + meaning: '持续 $n 秒内波动值过大,超过了 $m 个标准差范围', + meaningEn: 'within $n seconds, the fluctuation value exceeds the $m standard deviation range', + params: ['m'], + defaultValue: [3], + } }; export const defaultExpressionValue = {