diff --git a/lib/processAgent.js b/lib/processAgent.js index 5301029..5478b7e 100644 --- a/lib/processAgent.js +++ b/lib/processAgent.js @@ -27,15 +27,15 @@ const addMetrics = function (agent, pidToCheck) { const masterProcess = processes.filter(proc => proc.pid === pidToCheck).pop() const masterProcessMetric = { timestamp: timestamp, - measurement: 'nodejs.process', + measurement: 'process', tags: { token: infraToken, - 'nodejs.process.name': 'master', - 'nodejs.process.type': 'master' + 'process.name': 'node', + 'process.type': 'master' }, fields: { - 'cpu.percent': masterProcess.cpu, - memory: masterProcess.memory, + 'cpu.usage': masterProcess.cpu, + rss: masterProcess.memory, uptime: masterProcess.elapsed } } @@ -45,15 +45,15 @@ const addMetrics = function (agent, pidToCheck) { childProcesses.forEach((proc, counter) => { const childProcessMetric = { timestamp: timestamp, - measurement: 'nodejs.process', + measurement: 'process', tags: { token: infraToken, - 'nodejs.process.name': `child-${counter + 1}`, - 'nodejs.process.type': 'child' + 'process.name': 'node', + 'process.type': 'child' }, fields: { - 'cpu.percent': proc.cpu, - memory: proc.memory, + 'cpu.usage': proc.cpu, + rss: proc.memory, uptime: proc.elapsed } } @@ -63,10 +63,11 @@ const addMetrics = function (agent, pidToCheck) { const processCountMetric = { timestamp: timestamp, - measurement: 'nodejs.process', + measurement: 'process', tags: { token: infraToken, - 'nodejs.process.type': 'master' + 'process.type': 'master', + 'process.name': 'node' }, fields: { count: 1 @@ -75,10 +76,11 @@ const addMetrics = function (agent, pidToCheck) { agent.addMetrics(processCountMetric) const processChildCountMetric = { timestamp: timestamp, - measurement: 'nodejs.process', + measurement: 'process', tags: { token: infraToken, - 'nodejs.process.type': 'child' + 'process.type': 'child', + 'process.name': 'node' }, fields: { count: Math.max(processes.length - 1, 0) || 0 diff --git a/package-lock.json b/package-lock.json index 148c6eb..3c1a567 100644 --- a/package-lock.json +++ b/package-lock.json @@ -250,7 +250,7 @@ }, "colors": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=" }, "combined-stream": { @@ -327,7 +327,7 @@ }, "debug-log": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/debug-log/-/debug-log-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/debug-log/-/debug-log-1.0.1.tgz", "integrity": "sha1-IwdjLUwEOCuN+KMvcLiVBG1SdF8=", "dev": true }, @@ -957,7 +957,7 @@ }, "eslint-plugin-react": { "version": "7.14.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz", + "resolved": "http://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz", "integrity": "sha512-EzdyyBWC4Uz2hPYBiEJrKCUi2Fn+BJ9B/pJQcjw5X+x/H2Nm59S4MJIvL4O5NEE0+WbnQwEBxWY03oUk+Bc3FA==", "dev": true, "requires": { @@ -985,7 +985,7 @@ }, "eslint-plugin-standard": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.0.1.tgz", + "resolved": "http://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.0.1.tgz", "integrity": "sha512-v/KBnfyaOMPmZc/dmc6ozOdWqekGp7bBGq4jLAecEfPGmfKiWS4sA8sC0LqiV9w5qmXAtXVn4M3p1jSyhY85SQ==", "dev": true }, @@ -1167,8 +1167,7 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true, - "optional": true + "bundled": true }, "aproba": { "version": "1.2.0", @@ -1186,13 +1185,11 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1205,18 +1202,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -1319,8 +1313,7 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -1330,7 +1323,6 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -1343,20 +1335,17 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true, - "optional": true + "bundled": true }, "minipass": { "version": "2.3.5", "bundled": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -1373,7 +1362,6 @@ "mkdirp": { "version": "0.5.1", "bundled": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -1446,8 +1434,7 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -1457,7 +1444,6 @@ "once": { "version": "1.4.0", "bundled": true, - "optional": true, "requires": { "wrappy": "1" } @@ -1533,8 +1519,7 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true, - "optional": true + "bundled": true }, "safer-buffer": { "version": "2.1.2", @@ -1564,7 +1549,6 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -1582,7 +1566,6 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -1621,13 +1604,11 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, - "optional": true + "bundled": true }, "yallist": { "version": "3.0.3", - "bundled": true, - "optional": true + "bundled": true } } }, @@ -2407,7 +2388,7 @@ }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -2470,7 +2451,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "path-key": { @@ -3173,7 +3154,7 @@ }, "underscore": { "version": "1.4.4", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz", + "resolved": "http://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz", "integrity": "sha1-YaajIBBiKvoHljvzJSA88SI51gQ=" }, "uniq": { @@ -3262,7 +3243,7 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=" } } diff --git a/test/test.js b/test/test.js index d3b418f..c70f2ce 100644 --- a/test/test.js +++ b/test/test.js @@ -185,7 +185,7 @@ describe('SPM for Node.js tests', function () { if (metric.measurement && metric.measurement.indexOf('process') > -1 && metric.fields.uptime && metric.fields.memory && - metric.fields['cpu.percent']) { + metric.fields['cpu.usage']) { if (metric.tags.token !== config.tokens.infra) { console.log(metric) done(new Error(`No infra token set ${metric.tags.token} != ${config.tokens.infra}`))