memory usage stats
This commit is contained in:
parent
45d72e01a4
commit
8e16055183
3 changed files with 19 additions and 0 deletions
|
|
@ -2,10 +2,15 @@ import { MainSettings } from "../main/settings.js";
|
|||
import { StateBundler } from "../storage/stateBundler.js";
|
||||
|
||||
export class Utils {
|
||||
|
||||
stateBundler: StateBundler
|
||||
settings: MainSettings
|
||||
constructor(settings: MainSettings) {
|
||||
this.settings = settings
|
||||
this.stateBundler = new StateBundler(settings.storageSettings)
|
||||
}
|
||||
|
||||
Stop() {
|
||||
this.stateBundler.Stop()
|
||||
}
|
||||
}
|
||||
|
|
@ -84,6 +84,7 @@ export default class {
|
|||
this.lnd.Stop()
|
||||
this.applicationManager.Stop()
|
||||
this.paymentManager.Stop()
|
||||
this.utils.Stop()
|
||||
}
|
||||
|
||||
StartBeacons() {
|
||||
|
|
|
|||
|
|
@ -33,10 +33,23 @@ export class StateBundler {
|
|||
tlvStorage: TlvFilesStorage
|
||||
reportLog = getLogger({ component: 'stateBundlerReport' })
|
||||
prevValues: Record<string, number> = {}
|
||||
interval: NodeJS.Timeout
|
||||
constructor(settings: StorageSettings) {
|
||||
const bundlerPath = [settings.dataDir, "bundler_events"].filter(s => !!s).join("/")
|
||||
this.tlvStorage = new TlvFilesStorage(bundlerPath)
|
||||
this.tlvStorage.initMeta()
|
||||
this.interval = setInterval(() => {
|
||||
const mem = process.memoryUsage()
|
||||
this.AddValue('_root', 'memory_rss', mem.rss || 0, true)
|
||||
this.AddValue('_root', 'memory_buffer', mem.arrayBuffers || 0, true)
|
||||
this.AddValue('_root', 'memory_heap_total', mem.heapTotal || 0, true)
|
||||
this.AddValue('_root', 'memory_heap_used', mem.heapUsed || 0, true)
|
||||
this.AddValue('_root', 'memory_external', mem.external || 0, true)
|
||||
}, 60 * 1000)
|
||||
}
|
||||
|
||||
Stop() {
|
||||
clearInterval(this.interval)
|
||||
}
|
||||
|
||||
async GetBundleMetrics(req: Types.LatestBundleMetricReq): Promise<Types.BundleMetrics> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue