Skip to content

Commit ccdcd1f

Browse files
committed
src,test: add totalMem process metric
PR-URL: #469 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
1 parent ac25445 commit ccdcd1f

9 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/nsolid.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ int ProcessMetrics::Update() {
256256
(uv_hrtime() - node::per_process::node_start_time) / NANOS_PER_SEC;
257257
stor_.system_uptime = static_cast<uint64_t>(system_uptime);
258258
stor_.free_mem = uv_get_free_memory();
259+
stor_.total_mem = uv_get_total_memory();
259260
stor_.block_input_op_count = rusage.ru_inblock;
260261
stor_.block_output_op_count = rusage.ru_oublock;
261262
stor_.ctx_switch_involuntary_count = rusage.ru_nivcsw;

src/nsolid.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ struct LogWriteInfo;
4646
V(uint64_t, uptime, uptime, ECounter, kNSSecs) \
4747
V(uint64_t, system_uptime, systemUptime, ECounter, kNSSecs) \
4848
V(uint64_t, free_mem, freeMem, EGauge, kNSByte) \
49+
V(uint64_t, total_mem, totalMem, EGauge, kNSByte) \
4950
V(uint64_t, block_input_op_count, blockInputOpCount, ECounter, kNSNoUnit) \
5051
V(uint64_t, block_output_op_count, blockOutputOpCount, ECounter, kNSNoUnit) \
5152
V(uint64_t, ctx_switch_involuntary_count, \

test/addons/nsolid-statsdagent/nsolid-statsdagent.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ let expectedProcMetrics = [
1212
'uptime',
1313
'systemUptime',
1414
'freeMem',
15+
'totalMem',
1516
'blockInputOpCount',
1617
'blockOutputOpCount',
1718
'ctxSwitchInvoluntaryCount',

test/agents/test-grpc-metrics.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const expectedProcMetrics = [
1717
[ 'uptime', 's', 'asInt', 'sum' ],
1818
[ 'systemUptime', 's', 'asInt', 'sum' ],
1919
[ 'freeMem', 'byte', 'asInt', 'gauge' ],
20+
[ 'totalMem', 'byte', 'asInt', 'gauge' ],
2021
[ 'blockInputOpCount', '', 'asInt', 'sum' ],
2122
[ 'blockOutputOpCount', '', 'asInt', 'sum' ],
2223
[ 'ctxSwitchInvoluntaryCount', '', 'asInt', 'sum' ],

test/agents/test-otlp-grpc-metrics.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ if (process.argv[2] === 'child') {
5050
[ 'uptime', 's', 'asInt', 'sum' ],
5151
[ 'system_uptime', 's', 'asInt', 'sum' ],
5252
[ 'free_mem', 'byte', 'asInt', 'gauge' ],
53+
[ 'total_mem', 'byte', 'asInt', 'gauge' ],
5354
[ 'block_input_op_count', undefined, 'asInt', 'sum' ],
5455
[ 'block_output_op_count', undefined, 'asInt', 'sum' ],
5556
[ 'ctx_switch_involuntary_count', undefined, 'asInt', 'sum' ],

test/agents/test-otlp-metrics.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ if (process.argv[2] === 'child') {
5252
[ 'uptime', 's', 'asInt', 'sum' ],
5353
[ 'system_uptime', 's', 'asInt', 'sum' ],
5454
[ 'free_mem', 'byte', 'asInt', 'gauge' ],
55+
[ 'total_mem', 'byte', 'asInt', 'gauge' ],
5556
[ 'block_input_op_count', undefined, 'asInt', 'sum' ],
5657
[ 'block_output_op_count', undefined, 'asInt', 'sum' ],
5758
[ 'ctx_switch_involuntary_count', undefined, 'asInt', 'sum' ],

test/agents/test-statsd-connection.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const expectedMetrics = [
2323
'ctxSwitchInvoluntaryCount',
2424
'ctxSwitchVoluntaryCount',
2525
'freeMem',
26+
'totalMem',
2627
'ipcReceivedCount',
2728
'ipcSentCount',
2829
'load15m',

test/agents/test-zmq-metrics.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ function checkProcessMetrics(processMetrics) {
127127
validateNumber(processMetrics.uptime, 'processMetrics.uptime');
128128
validateNumber(processMetrics.systemUptime, 'processMetrics.systemUptime');
129129
validateNumber(processMetrics.freeMem, 'processMetrics.freeMem');
130+
validateNumber(processMetrics.totalMem, 'processMetrics.totalMem');
130131
validateUint32(processMetrics.blockInputOpCount, 'processMetrics.blockInputOpCount');
131132
validateUint32(processMetrics.blockOutputOpCount, 'processMetrics.blockOutputOpCount');
132133
validateUint32(processMetrics.ctxSwitchInvoluntaryCount, 'processMetrics.ctxSwitchInvoluntaryCount');

test/common/nsolid-metrics-util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const numberKeys = [
1818
'loopUtilization', 'res5s', 'res1m', 'res5m', 'res15m', 'loopTotalCount',
1919
'loopAvgTasks', 'loopEstimatedLag', 'loopIdlePercent', 'uptime',
2020
'systemUptime', 'freeMem', 'blockInputOpCount', 'blockOutputOpCount',
21-
'ctxSwitchInvoluntaryCount', 'ctxSwitchVoluntaryCount', 'ipcReceivedCount',
21+
'totalMem', 'ctxSwitchInvoluntaryCount', 'ctxSwitchVoluntaryCount', 'ipcReceivedCount',
2222
'ipcSentCount', 'pageFaultHardCount', 'pageFaultSoftCount', 'signalCount',
2323
'swapCount', 'rss', 'load1m', 'load5m', 'load15m', 'cpuUserPercent',
2424
'cpuSystemPercent', 'cpuPercent', 'cpu', 'pipeServerCreatedCount',

0 commit comments

Comments
 (0)