'use strict' ; import os from 'os' ; import { Router , RequestHandler , Request , Response , NextFunction } from 'express' ; import { setupMetaverseAPI , finishMetaverseAPI , param1FromParams } from '@Route-Tools/middleware' ; import { accountFromAuthToken } from '@Route-Tools/middleware' ; import { Logger } from '@Tools/Logging' ; import { Monitoring } from '@Monitoring/Monitoring' ; const procGetStatList = async ( req , resp , next ) => { if ( req . vAuthAccount ) { const statInfo = [ ] ; for ( const stat of Monitoring . getStats ( ) ) { statInfo . push ( { 'name' : stat . name , 'category' : stat . category , 'unit' : stat . unit } ) ; } ; req . vRestResp . Data = { 'stats' : statInfo } ; } else { req . vRestResp . respondFailure ( req . vAccountError ?? 'Not logged in' ) ; } ; next ( ) ; } ; export const name = '/api/v1/stats/list' ; export const router = Router ( ) ; router . get ( '/api/v1/stats/list' , [ setupMetaverseAPI , accountFromAuthToken , procGetStatList , finishMetaverseAPI ] ) ;