Skip to content

Commit 12ec628

Browse files
added pool-file-size-stat
1 parent ba00739 commit 12ec628

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

src/server/extension/monitoring-endpoint.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,20 +206,19 @@ process.stdin.on('end', () => {
206206
if (response.ok) {
207207
resolve(response.json());
208208
} else {
209-
throwError("Fehler bei der Anfrage an /xxx ", '');
209+
throwError("Fehler bei der Anfrage an /inspect/config ", '');
210210
}
211211
})
212212
.catch(error => {
213213
console.log(error);
214-
throwError("Fehler bei der Anfrage an /xxx ", '');
214+
throwError("Fehler bei der Anfrage an /inspect/config ", '');
215215
});
216216
});
217217
}
218218

219219
function getPoolStatsFromAPI() {
220220
return new Promise((resolve, reject) => {
221-
var url = 'http://fylr.localhost:8081/api/v1/pool/1/stats?include_subpools=1&access_token=' + access_token
222-
console.error("POOLSTATS");
221+
var url = 'http://fylr.localhost:8082/inspect/pools/1/'
223222
fetch(url, {
224223
headers: {
225224
'Accept': 'application/json'
@@ -229,12 +228,12 @@ process.stdin.on('end', () => {
229228
if (response.ok) {
230229
resolve(response.json());
231230
} else {
232-
throwError("Fehler bei der Anfrage an /pool/stats ", '');
231+
throwError("Fehler bei der Anfrage an /pools/stats ", '');
233232
}
234233
})
235234
.catch(error => {
236235
console.log(error);
237-
throwError("Fehler bei der Anfrage an /pool/stats ", '');
236+
throwError("Fehler bei der Anfrage an /pools/stats ", '');
238237
});
239238
});
240239
}
@@ -446,8 +445,6 @@ process.stdin.on('end', () => {
446445
// check if all objecttypes and tags, which are used in validation still exist!
447446
const objecttypeList = infoData[2].tables.map(item => item.name);
448447

449-
console.error(" infoData[4]");
450-
console.error( infoData[4]);
451448
const tagList = infoData[4].Tags.flatMap(item => item.Tags.map(tag => tag.Id));
452449

453450
// check tags
@@ -494,7 +491,17 @@ process.stdin.on('end', () => {
494491
}
495492

496493
// poolstats
497-
console.error(infoData[8]);
494+
if (infoData[8]) {
495+
if (infoData[8].PoolStatsSubpools) {
496+
result.file_stats = {};
497+
result.file_stats.count = infoData[8].PoolStatsSubpools.files.count;
498+
var sizeString = (infoData[8].PoolStatsSubpools.files.size / (1024 ** 3)).toFixed(2) + ' GB';
499+
if(sizeString == '0.00 GB') {
500+
sizeString = (infoData[8].PoolStatsSubpools.files.size / (1024 ** 2)).toFixed(2) + ' MB';
501+
}
502+
result.file_stats.size = sizeString;
503+
}
504+
}
498505

499506
// parse info from settings (via session)
500507
result.name = sessionData.instance.name;

0 commit comments

Comments
 (0)