commit
4b86cd12b5
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";
|
import { StateBundler } from "../storage/stateBundler.js";
|
||||||
|
|
||||||
export class Utils {
|
export class Utils {
|
||||||
|
|
||||||
stateBundler: StateBundler
|
stateBundler: StateBundler
|
||||||
settings: MainSettings
|
settings: MainSettings
|
||||||
constructor(settings: MainSettings) {
|
constructor(settings: MainSettings) {
|
||||||
this.settings = settings
|
this.settings = settings
|
||||||
this.stateBundler = new StateBundler(settings.storageSettings)
|
this.stateBundler = new StateBundler(settings.storageSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Stop() {
|
||||||
|
this.stateBundler.Stop()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -84,6 +84,7 @@ export default class {
|
||||||
this.lnd.Stop()
|
this.lnd.Stop()
|
||||||
this.applicationManager.Stop()
|
this.applicationManager.Stop()
|
||||||
this.paymentManager.Stop()
|
this.paymentManager.Stop()
|
||||||
|
this.utils.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
StartBeacons() {
|
StartBeacons() {
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,23 @@ export class StateBundler {
|
||||||
tlvStorage: TlvFilesStorage
|
tlvStorage: TlvFilesStorage
|
||||||
reportLog = getLogger({ component: 'stateBundlerReport' })
|
reportLog = getLogger({ component: 'stateBundlerReport' })
|
||||||
prevValues: Record<string, number> = {}
|
prevValues: Record<string, number> = {}
|
||||||
|
interval: NodeJS.Timeout
|
||||||
constructor(settings: StorageSettings) {
|
constructor(settings: StorageSettings) {
|
||||||
const bundlerPath = [settings.dataDir, "bundler_events"].filter(s => !!s).join("/")
|
const bundlerPath = [settings.dataDir, "bundler_events"].filter(s => !!s).join("/")
|
||||||
this.tlvStorage = new TlvFilesStorage(bundlerPath)
|
this.tlvStorage = new TlvFilesStorage(bundlerPath)
|
||||||
this.tlvStorage.initMeta()
|
this.tlvStorage.initMeta()
|
||||||
|
this.interval = setInterval(() => {
|
||||||
|
const mem = process.memoryUsage()
|
||||||
|
this.AddValue('_root', 'memory_rss_kb', Math.ceil(mem.rss / 1000 || 0), true)
|
||||||
|
this.AddValue('_root', 'memory_buffer_kb', Math.ceil(mem.arrayBuffers / 1000 || 0), true)
|
||||||
|
this.AddValue('_root', 'memory_heap_total_kb', Math.ceil(mem.heapTotal / 1000 || 0), true)
|
||||||
|
this.AddValue('_root', 'memory_heap_used_kb', Math.ceil(mem.heapUsed / 1000 || 0), true)
|
||||||
|
this.AddValue('_root', 'memory_external_kb', Math.ceil(mem.external / 1000 || 0), true)
|
||||||
|
}, 60 * 1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
Stop() {
|
||||||
|
clearInterval(this.interval)
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetBundleMetrics(req: Types.LatestBundleMetricReq): Promise<Types.BundleMetrics> {
|
async GetBundleMetrics(req: Types.LatestBundleMetricReq): Promise<Types.BundleMetrics> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue