metrics: add route to query app metrics with the system

This commit is contained in:
Girish Ramakrishnan
2025-07-07 10:09:36 +02:00
parent 24975d670e
commit 369474a0bc
4 changed files with 30 additions and 15 deletions
+9 -1
View File
@@ -86,7 +86,15 @@ function create() {
async getMetrics(options) {
let error, result;
try {
result = await fetcher.get(`${API_ORIGIN}/api/v1/system/metrics`, { fromSecs: options.fromSecs, intervalSecs: options.intervalSecs, access_token: accessToken });
const query = [
['fromSecs', options.fromSecs],
['intervalSecs', options.intervalSecs],
['system', String(!!options.system)],
...options.appIds.map(id => ['appId', id]), // multiple appId=xx
...options.serviceIds.map(id => ['serviceId', id]), // multiple serviceId=xx
['access_token', accessToken]
];
result = await fetcher.get(`${API_ORIGIN}/api/v1/system/metrics`, query);
} catch (e) {
error = e;
}