Add resident memory and heap size metrics

Implement the default resident memory and heap size metrics.
This commit is contained in:
Hornwitser committed 2020-04-09 16:17:38 +02:00
1 parent e908c5069b
commit 56488b2c2d
2 files changed
+60

No files matched your search

+20
View File
@@ -409,6 +409,26 @@ defaultCollectors.processCpuSecondsTotal = new Gauge(
},
);
defaultCollectors.processResidentMemoryBytes = new Gauge(
'process_resident_memory_bytes',
"Resident memory size in bytes.",
{
callback: function() {
this.set(process.memoryUsage().rss);
},
},
);
defaultCollectors.processHeapBytes = new Gauge(
'process_heap_bytes',
"Process heap size in bytes.",
{
callback: function() {
this.set(process.memoryUsage().heapUsed);
},
},
);
defaultCollectors.processStartTimeSeconds = new Gauge(
'process_start_time_seconds',
"Start time of the process since unix epoch in seconds."