Clear Garbage (Test)

main
DenisN 2025-04-15 04:13:45 -04:00
parent b50beb3fa8
commit d219337ed3
2 changed files with 13 additions and 18 deletions

View File

@ -1,14 +1,15 @@
[
{
"name": "measure_190",
{
"name": "measure_190", "_comment":"Загрузка процессора за 1 минуту",
"ranges": [
{"min": 0, "max": 0, "status": 3},
{"min": 0, "max": 0.1, "status": 0},
{"min": 0.11, "max": 0.12, "status": 1},
{"min": 0.13, "max": 1, "status": 2}
]
},
{
"name": "measure_191",
"name": "measure_191", "_comment":"Загрузка процессора за 5 минут",
"ranges": [
{"min": 0, "max": 0.2, "status": 0},
{"min": 0.21, "max": 0.32, "status": 1},

View File

@ -46,7 +46,6 @@ export class ZvksmetricsService {
scope = await this.setMetricsRanges ();
let editedMetrics : K2Metrics = await this.getMetrics (inp, scope);
// console.log(editedMetrics.metrics.find(el=>el.id='measure_191')?.status);
let responseFromExporter : any = await this.sendMetrics (editedMetrics);
return responseFromExporter;
@ -58,24 +57,18 @@ export class ZvksmetricsService {
for(let i=0; i<length; i++){
arr[i].status = await this.setMetricsStatus(arr[i], scope);
// console.log(arr[i].status);
// console.log(arr[i].id);
}
inputData.metrics = arr;
// console.log(arr.findIndex(el=>el.id='measure_190'));
return inputData;
}
async setMetricsStatus( metric : MetricK2, scope: MetricsRanges []) : Promise<number> {
if (metric && scope){
let a = await this.showStatus(scope, metric.id, metric.value);
// console.log(a);
return await this.showStatus(scope, metric.id, metric.value);
}
else {
return 0;
return 4;
}
}
@ -100,15 +93,16 @@ export class ZvksmetricsService {
let status : number = 0;
let test : any = scope.find(element => element.name == metricName);
if (test){
// let range : MetricsRanges = new MetricsRanges;
let range : MetricsRanges = test;
let transit : any = range.ranges.find(element => element.min <= metricValue && metricValue <= element.max)?.status;
status = transit;
// console.log(status);
if(transit){
status = transit;
return status;
}
else{
return 4;
}
}
// console.log(scope);
// console.log(range);
// console.log(status);
return status;
}