Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #525 from Financial-Times/bye-bye-metrics
Browse files Browse the repository at this point in the history
Remove asset size metrics from deploy-hashed-assets / deploy-static
  • Loading branch information
simonplend authored Oct 8, 2018
2 parents 6941b6b + d94f377 commit 4308714
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 37 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"isomorphic-fetch": "^2.0.0",
"md5-file": "^3.1.0",
"mime": "^1.3.4",
"next-metrics": "^1.48.18",
"node-vault": "^0.5.6",
"nodemon": "^1.11.0",
"semver": "^5.0.3",
Expand Down
18 changes: 1 addition & 17 deletions tasks/deploy-hashed-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const readFile = denodeify(require('fs').readFile);
const waitForOk = require('../lib/wait-for-ok');
const path = require('path');
const aws = require('aws-sdk');
const Metrics = require('next-metrics').Metrics;

const AWS_ACCESS_HASHED_ASSETS = process.env.AWS_ACCESS_HASHED_ASSETS || process.env.aws_access_hashed_assets;
const AWS_SECRET_HASHED_ASSETS = process.env.AWS_SECRET_HASHED_ASSETS || process.env.aws_secret_hashed_assets;
Expand Down Expand Up @@ -59,16 +58,6 @@ function task (opts) {

const app = normalizeName(packageJson.name, { version: false });

const metrics = new Metrics;
metrics.init({
platform: 's3',
app: app,
instance: false,
useDefaultAggregators: false,
flushEvery: false,
forceGraphiteLogging: true
});

console.log('Deploying hashed assets to S3...'); // eslint-disable-line no-console

return Promise.all(Object.keys(assetHashes)
Expand Down Expand Up @@ -121,15 +110,10 @@ function task (opts) {
const contentSize = Buffer.byteLength(content);
const gzippedContentSize = Buffer.byteLength(values[2]);
console.log(`${file} is ${contentSize} bytes (${gzippedContentSize} bytes gzipped)`); // eslint-disable-line no-console
metrics.count(`${file}.size`, contentSize);
metrics.count(`${file}.gzip_size`, gzippedContentSize);
});
});
})
)
.then(() => {
metrics.flush();
});
);
}

module.exports = function (program, utils) {
Expand Down
20 changes: 1 addition & 19 deletions tasks/deploy-static.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const path = require('path');
const co = require('co');
const md5File = denodeify(require('md5-file'));
const gzip = denodeify(require('zlib').gzip);
const Metrics = require('next-metrics').Metrics;
const isImage = require('is-image');
const waitForOk = require('../lib/wait-for-ok');

Expand All @@ -26,17 +25,6 @@ function task (opts) {
const destination = opts.destination || '';
const bucket = opts.bucket;

const metrics = new Metrics;
metrics.init({
platform: 's3',
app: opts.bucket,
instance: false,
useDefaultAggregators: false,
flushEvery: false,
forceGraphiteLogging: true
});


if (files.length < 1) {
return Promise.reject('No files found for upload to s3. (Directories are ignored)');
}
Expand Down Expand Up @@ -110,17 +98,11 @@ function task (opts) {
const contentSize = Buffer.byteLength(content);
const gzippedContentSize = Buffer.byteLength(gzipped);
console.log(`${key} is ${contentSize} bytes (${gzippedContentSize} bytes gzipped)`); // eslint-disable-line no-console
let safeFile = opts.monitorStripDirectories ? key.split('/').pop() : key.replace(/\//g, '.');
metrics.count(`${safeFile}.size`, contentSize);
metrics.count(`${safeFile}.gzip_size`, gzippedContentSize);
});
console.log(`Successfully uploaded: ${key}`); // eslint-disable-line no-console
}
});
}))
.then(() => {
metrics.flush();
});
}));
};

module.exports = function (program, utils) {
Expand Down

0 comments on commit 4308714

Please sign in to comment.