Skip to content

Commit

Permalink
remove process agent
Browse files Browse the repository at this point in the history
  • Loading branch information
Adnan Rahic committed Jan 13, 2021
1 parent 5cda30f commit eb6fe30
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 239 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ addons:
packages:
- g++-4.8
node_js:
- "6"
- "8"
- "10"
- "12"
- "14"
install:
- export CXX=g++-4.8
- $CXX --version
Expand Down
33 changes: 16 additions & 17 deletions example/childProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,18 @@ spmAgent.on('metric', function (metric) {
// if (metric.name === 'http') {
// if (metric.name === 'numWorkers') {
// if (metric.sct === 'APP') {
if (
metric.name === 'process' ||
metric.name === 'numWorkers'
) {
if (metric.name === 'process' || metric.name === 'numWorkers') {
console.log(metric)
}
})

spmAgent.on('metric', function (metric) {
if (
metric.measurement === 'nodejs.process'
) {
console.log(metric)
console.log('\n\n')
}
// if (
// metric.measurement === 'nodejs.process'
// ) {
console.log(metric)
console.log('\n\n')
// }
})

// if (process.send === undefined) {
Expand All @@ -33,11 +30,13 @@ spmAgent.on('metric', function (metric) {
const { resolve } = require('path')
const { fork } = require('child_process')
const http = require('http')
http.createServer(function (req, res) {
const longComputation = fork(resolve(__dirname, 'longComputation.js'))
longComputation.send('start')
longComputation.on('message', sum => {
res.end(String(sum))
longComputation.kill(1)
http
.createServer(function (req, res) {
const longComputation = fork(resolve(__dirname, 'longComputation.js'))
longComputation.send('start')
longComputation.on('message', sum => {
res.end(String(sum))
longComputation.kill(1)
})
})
}).listen(4000)
.listen(4000)
26 changes: 15 additions & 11 deletions example/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const masterProcess = () => {

for (let i = 0; i < numCPUs; i++) {
cluster.fork()
cluster.on('exit', (worker) => cluster.fork())
cluster.on('exit', worker => cluster.fork())
}
}
const childProcess = () => {
Expand All @@ -42,18 +42,22 @@ const childProcess = () => {
// console.log(stats)
})
spmAgent.on('metric', function (metric) {
if (
// metric.name === 'process' ||
metric.name === 'numWorkers'
) {
console.log(metric)
}
// if (
// metric.name === 'process' ||
// metric.name === 'numWorkers'
// ) {
console.log(metric)
// }
})

console.log(`Worker${cluster.worker.id} running on port ${port} with pid ${cluster.worker.process.pid}`)
http.createServer(function (req, res) {
res.end('Hello World')
}).listen(port)
console.log(
`Worker${cluster.worker.id} running on port ${port} with pid ${cluster.worker.process.pid}`
)
http
.createServer(function (req, res) {
res.end('Hello World')
})
.listen(port)
}

if (cluster.isMaster) {
Expand Down
1 change: 0 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function NodeJSAgent () {
'./eventLoopAgent.js',
'./gcAgent.js',
'./httpServerAgent.js',
'./processAgent.js',
'./workerAgent.js'
]
agentsToLoad.forEach(function (a) {
Expand Down
185 changes: 0 additions & 185 deletions lib/processAgent.js

This file was deleted.

Loading

0 comments on commit eb6fe30

Please sign in to comment.