-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #732 from heroku/updated-tarballs
updated plugins
- Loading branch information
Showing
22 changed files
with
164 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
.anvil | ||
.DS_Store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
d6ad0f45d5564f324147f590ce9ac39c5973a64dfb1905eb993dfcf3dce21b6934a7821ffbd853ff30e89952ba17e7667809152e187453d7c18579d945a5f8bd heroku-nodejs-plugin-node-10-v5.tar.gz | ||
24080f0918d31ea85fc1f5ef05b2d31667f801f383a719b0e099bb89f372b104655329152c4cb822a331a3c4880f042568dce2947e4dd4b782a0c891bed81d95 heroku-nodejs-plugin-node-10-v6.tar.gz |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0afc36d4268b7ce3dd1c59813d7727a1bae715645bc0fb006ca992ccd028df692e31d2a4df697ab08d6b4baad03cd6ebef8525e481e0c5cf12e810c30e1da0cb heroku-nodejs-plugin-node-11-v5.tar.gz | ||
ad13b8ddf4b08f4a7f1967b8e2502e7de5738ae1fe06dcab729ffc25e5dbc1f66dd1ac199941d8f2dbaffc9d6595b848642068b4e7224cf38e0b37397bed5d11 heroku-nodejs-plugin-node-11-v6.tar.gz |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0020b60fd3aebcc1fb13770e3445a93c0633579853ee0d31d3dc12d02e4a8a1d418a4d4add2145da46f9d2820f6ae1e412a0beb4eb3e46d7fc8326d2e2d8248d heroku-nodejs-plugin-node-12-v5.tar.gz | ||
e06c275a0882981fa1d263beb05a35ce8b155558050670b439ac677c58079034a1d00d80488855b25decc08d4a1b68821f587e9b785adf344641c81204ebc71d heroku-nodejs-plugin-node-12-v6.tar.gz |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
eafcdb643017fa72a74d5b52d2bf2b472179cb30e3b039b45467f3be375d91ab3fd8728fc200312b4e13f5506711ede470adad63cf3770b14b13a7ba21cb6d01 heroku-nodejs-plugin-node-13-v6.tar.gz |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
d96566824853bc7657fbf2f651067ed0b1747e4d6b4b9b443df6f2d490742b4e571dff5165e68c6d8af44501af0bdddd98e71eeb5fcc9816348453a1f8a314d9 heroku-nodejs-plugin-node-8-v5.tar.gz | ||
1b5fe2af49941487b954a0226680f11de78a508585a9c6ee5e7aec3dcc02c290dc08c300a29e13b1acf16378679793b74dc670734cfcebd74396a7d1d49ed027 heroku-nodejs-plugin-node-8-v6.tar.gz |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
eefbf22a508e0fd4dea303a7d247a4c6ebb60803c5221e43dd6a9921332ad32791f6b4e95a3379c519290a6767a1dc797f3e68ed583427a53695f47c7b80ccdd heroku-nodejs-plugin-node-9-v5.tar.gz | ||
450035c314ccd5bf97035d5f297488a317e4bfc21e11e3f5cae94d63704aef70f0d5a2e91be01ba2b723f687656c68561024061beda66edecd8d5989bd73d647 heroku-nodejs-plugin-node-9-v6.tar.gz |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: node src/index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "node-metrics-test-app", | ||
"version": "1.0.0", | ||
"engines": { | ||
"node": "13.x" | ||
}, | ||
"main": "index.js", | ||
"license": "MIT", | ||
"devDependencies": {}, | ||
"dependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env node | ||
|
||
const http = require('http'); | ||
const EventEmitter = require('events'); | ||
|
||
const PORT = process.env.PORT || 5000; | ||
const Events = new EventEmitter(); | ||
|
||
// This will block the event loop for ~lengths of time | ||
function blockCpuFor(ms) { | ||
return new Promise((resolve, reject) => { | ||
setTimeout(() => { | ||
console.log(`blocking the event loop for ${ms}ms`); | ||
let now = new Date().getTime(); | ||
let result = 0 | ||
while(true) { | ||
result += Math.random() * Math.random(); | ||
if (new Date().getTime() > now + ms) | ||
break; | ||
} | ||
resolve(); | ||
}, 100); | ||
}); | ||
} | ||
|
||
function getNextMetricsEvent() { | ||
return new Promise((resolve, reject) => Events.once('metrics', resolve)); | ||
} | ||
|
||
const server = http.createServer((req, res) => { | ||
// wait for the next metrics event | ||
getNextMetricsEvent() | ||
.then(blockCpuFor(2000)) | ||
.then(blockCpuFor(100)) | ||
.then(blockCpuFor(100)) | ||
.then(blockCpuFor(100)) | ||
.then(blockCpuFor(100)) | ||
.then(blockCpuFor(100)) | ||
.then(blockCpuFor(100)) | ||
.then(blockCpuFor(100)) | ||
.then(blockCpuFor(100)) | ||
.then(blockCpuFor(100)) | ||
.then(blockCpuFor(100)) | ||
// gather the next metrics data which should include these pauses | ||
.then(getNextMetricsEvent()) | ||
.then(data => { | ||
res.setHeader('Content-Type', 'application/json'); | ||
res.end(data); | ||
}) | ||
.catch(() => { | ||
res.statusCode = 500; | ||
res.end("Something went wrong"); | ||
}); | ||
}); | ||
|
||
server.listen(PORT, () => console.log(`Listening on ${PORT}`)); | ||
|
||
// Create a second server that intercepts the HTTP requests | ||
// sent by the metrics plugin | ||
const metricsListener = http.createServer((req, res) => { | ||
if (req.method == 'POST') { | ||
let body = ''; | ||
req.on('data', (data) => body += data); | ||
req.on('end', () => { | ||
res.statusCode = 200; | ||
res.end(); | ||
Events.emit('metrics', body) | ||
}); | ||
} | ||
}); | ||
|
||
metricsListener.listen(3000, () => console.log('Listening for metrics on 3000')); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: node src/index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name": "hello-world" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "hello-world", | ||
"version": "1.0.0", | ||
"engines": { | ||
"node": "13.x" | ||
}, | ||
"scripts": { | ||
"prettify": "prettier --single-quote --trailing-comma all --write 'bin/*' 'src/**/*.js'", | ||
"test": "jest --silent", | ||
"dev": "nodemon --watch . --watch src/* src/index.js", | ||
"heroku-postbuild": "echo NODE_OPTIONS: $NODE_OPTIONS" | ||
}, | ||
"main": "index.js", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"jest": "^19.0.2", | ||
"nodemon": "^1.19.4", | ||
"prettier": "^0.22.0" | ||
}, | ||
"dependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env node | ||
|
||
const http = require('http'); | ||
const crypto = require('crypto'); | ||
|
||
const PORT = process.env.PORT || 5000; | ||
|
||
// This will block the event loop for ~lengths of time | ||
function blockCpuFor(ms) { | ||
var now = new Date().getTime(); | ||
var result = 0 | ||
while(true) { | ||
result += Math.random() * Math.random(); | ||
if (new Date().getTime() > now +ms) | ||
return; | ||
} | ||
} | ||
|
||
// block the event loop for 100ms every second | ||
setInterval(() => { | ||
blockCpuFor(100); | ||
}, 1000) | ||
|
||
// block the event loop for 1sec every 30 seconds | ||
setInterval(() => { | ||
blockCpuFor(1000); | ||
}, 30000) | ||
|
||
// Allocate and erase memory on an interval | ||
let store = []; | ||
|
||
setInterval(() => { | ||
store.push(crypto.randomBytes(1000000).toString('hex')); | ||
}, 500); | ||
|
||
setInterval(() => { | ||
store = []; | ||
}, 60000); | ||
|
||
const server = http.createServer((req, res) => { | ||
res.statusCode = 200; | ||
res.setHeader('Content-Type', 'text/plain'); | ||
res.end("Hello, world!"); | ||
}) | ||
|
||
server.listen(PORT, () => console.log(`Listening on ${PORT}`)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters