Skip to content

Commit

Permalink
Merge pull request #732 from heroku/updated-tarballs
Browse files Browse the repository at this point in the history
updated plugins
  • Loading branch information
danielleadams authored Dec 16, 2019
2 parents 4bc066a + 41f11af commit 0c0c2f7
Show file tree
Hide file tree
Showing 22 changed files with 164 additions and 8 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
.anvil
.DS_Store

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Node.js Buildpack Changelog

## master
- Add Node 13 metrics plugin ([#731](https://github.com/heroku/heroku-buildpack-nodejs/pull/731), [#732](https://github.com/heroku/heroku-buildpack-nodejs/pull/732))
- Fix yarn cache feature flag ([#729](https://github.com/heroku/heroku-buildpack-nodejs/pull/729))
- Add Node 13 metrics plugin ([#731](https://github.com/heroku/heroku-buildpack-nodejs/pull/731))

## V165 (2019-10-24)
- Update README ([#725](https://github.com/heroku/heroku-buildpack-nodejs/pull/725))
Expand Down
2 changes: 1 addition & 1 deletion plugin/heroku-nodejs-plugin-node-10.sha512
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 modified plugin/heroku-nodejs-plugin-node-10.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion plugin/heroku-nodejs-plugin-node-11.sha512
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 modified plugin/heroku-nodejs-plugin-node-11.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion plugin/heroku-nodejs-plugin-node-12.sha512
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 modified plugin/heroku-nodejs-plugin-node-12.tar.gz
Binary file not shown.
1 change: 1 addition & 0 deletions plugin/heroku-nodejs-plugin-node-13.sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eafcdb643017fa72a74d5b52d2bf2b472179cb30e3b039b45467f3be375d91ab3fd8728fc200312b4e13f5506711ede470adad63cf3770b14b13a7ba21cb6d01 heroku-nodejs-plugin-node-13-v6.tar.gz
Binary file added plugin/heroku-nodejs-plugin-node-13.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion plugin/heroku-nodejs-plugin-node-8.sha512
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 modified plugin/heroku-nodejs-plugin-node-8.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion plugin/heroku-nodejs-plugin-node-9.sha512
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 modified plugin/heroku-nodejs-plugin-node-9.tar.gz
Binary file not shown.
1 change: 1 addition & 0 deletions spec/fixtures/repos/node-13-metrics/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node src/index.js
11 changes: 11 additions & 0 deletions spec/fixtures/repos/node-13-metrics/package.json
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": {}
}
73 changes: 73 additions & 0 deletions spec/fixtures/repos/node-13-metrics/src/index.js
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'));

1 change: 1 addition & 0 deletions spec/fixtures/repos/node-13/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node src/index.js
3 changes: 3 additions & 0 deletions spec/fixtures/repos/node-13/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "hello-world"
}
21 changes: 21 additions & 0 deletions spec/fixtures/repos/node-13/package.json
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": {}
}
46 changes: 46 additions & 0 deletions spec/fixtures/repos/node-13/src/index.js
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}`));
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def resolve_all_supported_node_versions(options = {})
end

def version_supports_metrics(version)
SemVersion.new(version).satisfies?('>= 8.0.0') && SemVersion.new(version).satisfies?('< 13.0.0')
SemVersion.new(version).satisfies?('>= 8.0.0') && SemVersion.new(version).satisfies?('< 14.0.0')
end

def get_test_versions
Expand Down

0 comments on commit 0c0c2f7

Please sign in to comment.