UNPKG

nodereactionagent

Version:

NodeReaction Agent is node application performance monitoring tool

24 lines (21 loc) 599 B
const uuidv4 = require("uuid/v4"); const TraceTimer = require("./TraceTimer"); class Trace { constructor(transaction, library, type) { this.transaction = transaction; this.library = library; this.type = type; this.uuid = uuidv4(); this.finished = false; this.traceTimer = new TraceTimer(this.uuid); this.traceTimer.start(); } end() { this.traceTimer.end(); // update our state and notify toplevel singleton of completed state this.finished = true; if(this.transaction) this.transaction.becomeGlobalTransaction(); } } module.exports = Trace;