From c253a8ba39b9667f814e6f2a0fca2aa0b1224c14 Mon Sep 17 00:00:00 2001 From: Ovidiu Viorel Iepure Date: Mon, 24 Oct 2016 05:34:08 -0700 Subject: [PATCH] Activity session Summary: Add session ID to be appended to every event in the current Packager session. Reviewed By: davidaurelio Differential Revision: D4029580 fbshipit-source-id: 8c34c1f44ee63f845d15f8f89e491ab5c936fb21 --- react-packager/src/Activity/Types.js | 1 + react-packager/src/Activity/index.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/react-packager/src/Activity/Types.js b/react-packager/src/Activity/Types.js index cc996c74..80aea02b 100644 --- a/react-packager/src/Activity/Types.js +++ b/react-packager/src/Activity/Types.js @@ -32,5 +32,6 @@ export type Event = { id: number, name: string, options: Options, + session: string, startTimeStamp: [number, number], }; diff --git a/react-packager/src/Activity/index.js b/react-packager/src/Activity/index.js index 4ad5ad05..7eac9f84 100644 --- a/react-packager/src/Activity/index.js +++ b/react-packager/src/Activity/index.js @@ -17,10 +17,12 @@ const chalk = require('chalk'); const events = require('events'); const formatData = require('./formatData'); const normaliseEventData = require('./normaliseEventData'); +const os = require('os'); let ENABLED = true; let UUID = 1; +const session = `${os.hostname()}-${Date.now()}`; const EVENT_INDEX: {[key: number]: Event} = Object.create(null); const EVENT_EMITTER = new events.EventEmitter(); @@ -35,6 +37,7 @@ function startEvent(name: string, data: EventData = {}, options: Options = {}): id, options, name, + session, startTimeStamp: process.hrtime(), }; logEvent(id, 'startEvent');