<commit_before>var Promise = require('es6-promise').Promise
var logger = require('../lib/logger')
var frames = require('../exceptions/frames')
var traceCache = require('./traceCache')

var Trace = module.exports = function (transaction, signature, type) {
  this.transaction = transaction
  this.signature = signature
  this.type = type
  this.ended = false
  this._parent = null

  // Start timers
  this._start = window.performance.now()
  this._startStamp = new Date()

  this._isFinish = new Promise(function (resolve, reject) {
    this._markFinishedFunc = resolve
  }.bind(this))

  this.getTraceStackFrames(function (frames) {
    if (frames) {
      this.frames = frames
    }
    this._markFinishedFunc() // Mark the trace as finished
  }.bind(this))

  logger.log('%c -- opbeat.instrumentation.trace.start', 'color: #9a6bcb', this.signature, this._start)
}

Trace.prototype.end = function () {<commit_msg>Reverse stack frames on traces to make front-end rendering correct<commit_after>var Promise = require('es6-promise').Promise
var logger = require('../lib/logger')
var frames = require('../exceptions/frames')
var traceCache = require('./traceCache')

var Trace = module.exports = function (transaction, signature, type) {
  this.transaction = transaction
  this.signature = signature
  this.type = type
  this.ended = false
  this._parent = null

  // Start timers
  this._start = window.performance.now()
  this._startStamp = new Date()

  this._isFinish = new Promise(function (resolve, reject) {
    this._markFinishedFunc = resolve
  }.bind(this))

  this.getTraceStackFrames(function (frames) {
    if (frames) {
      this.frames = frames.reverse() // Reverse frames to make Opbeat happy
    }
    this._markFinishedFunc() // Mark the trace as finished
  }.bind(this))

  logger.log('%c -- opbeat.instrumentation.trace.start', 'color: #9a6bcb', this.signature, this._start)
}

Trace.prototype.end = function () {
{'fraction_non_alphanumeric': 0.13457556935817805, 'fraction_numerical': 0.003105590062111801, 'mean_word_length': 3.844611528822055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7221571', 'n_tokens_mistral': 590, 'n_tokens_neox': 569, 'n_words': 145}