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";
|
||||
|
||||
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_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> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue