File tree Expand file tree Collapse file tree 1 file changed +10
-13
lines changed
frontend/src/app/shared/util Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change 11import { ElasticHealthStatsType } from '../types/elasticsearch/elastic-health-stats.type' ;
2-
32export function getElasticClusterHealth ( clusterHealth : ElasticHealthStatsType ,
43 connection : 'UP' | 'DOWN' ) : 'CRITIC' | 'MEDIUM' | 'UP' | 'DOWN' {
54 if ( clusterHealth ) {
6- if ( clusterHealth . diskUsedPercent > 84 ) {
7- return 'CRITIC' ;
8- }
9- if ( clusterHealth . heapPercent > 85 ) {
5+ const { diskUsedPercent, heapPercent } = clusterHealth ;
6+
7+ if ( diskUsedPercent > 84 || heapPercent > 85 ) {
108 return 'CRITIC' ;
119 }
12- if ( clusterHealth . diskUsedPercent > 75 && this . clusterHealth . diskUsedPercent <= 85 ) {
10+
11+ if ( ( diskUsedPercent > 75 && diskUsedPercent <= 85 ) || ( heapPercent >= 50 && heapPercent <= 85 ) ) {
1312 return 'MEDIUM' ;
14- } else if ( clusterHealth . diskUsedPercent <= 50 ) {
15- return 'UP' ;
1613 }
17- if ( clusterHealth . heapPercent >= 50 && this . clusterHealth . heapPercent <= 85 ) {
18- return 'MEDIUM' ;
19- } else if ( clusterHealth . heapPercent < 50 ) {
14+
15+ if ( diskUsedPercent <= 50 && heapPercent < 50 ) {
2016 return 'UP' ;
21- } else {
22- return connection ;
2317 }
18+
19+ return connection ;
20+
2421 } else {
2522 return connection ;
2623 }
You can’t perform that action at this time.
0 commit comments