Add file transform event to Activity

Summary: Add a telemetric event to the transformer.

Reviewed By: davidaurelio

Differential Revision: D3950902

fbshipit-source-id: c46e95ee93925fb0f9d1784aebdc3206baf74dc6
This commit is contained in:
Ovidiu Viorel Iepure 2016-09-30 08:29:21 -07:00 committed by Facebook Github Bot
parent f3f12c6d2d
commit 351d9da0e8
1 changed files with 10 additions and 0 deletions

View File

@ -8,6 +8,7 @@
*/
'use strict';
const Activity = require('../Activity');
const Promise = require('promise');
const declareOpts = require('../lib/declareOpts');
const os = require('os');
@ -90,10 +91,19 @@ class Transformer {
return Promise.reject(new Error('No transform module'));
}
debug('transforming file', fileName);
const transformEventId = Activity.startEvent(
'Transforming file',
fileName,
{
telemetric: true,
silent: true,
},
);
return this
._transform(this._transformModulePath, fileName, code, options)
.then(result => {
debug('done transforming file', fileName);
Activity.endEvent(transformEventId);
return result;
})
.catch(error => {