<commit_before>const mongoose = require('mongoose')

const Schema = new mongoose.Schema({
  route: {type: String},
  host: {type: String},
  method: {type: String},
  statusCode: {type: Number},
  events: [{
    label: String,
    elapsed: Number
  }],
  timestamp : {type: Date, default: Date.now, expires: 3600*24*5, index: true},
  elapsed: {type: Number, index: true}
})

Schema.statics.startRequest = async function (req) {
  if (req.raw.method.match(/GET|POST/)) {
    req.profiler = new this({route: req.raw.originalUrl.replace(/(&|\?)_ref=.*(&|$)/, ''), method: req.raw.method, host: req.hostname, events: [{label: 'Request', elapsed: 0}]})
    await req.profiler.save()
  }<commit_msg>some debug<commit_after>const mongoose = require('mongoose')

const Schema = new mongoose.Schema({
  route: {type: String, index: true},
  host: {type: String},
  method: {type: String, index: true},
  statusCode: {type: Number},
  events: [{
    label: String,
    elapsed: Number
  }],
  timestamp : {type: Date, default: Date.now, expires: 3600*24*5, index: true},
  elapsed: {type: Number, index: true}
})

Schema.statics.startRequest = async function (req) {
  if (req.raw.method.match(/GET|POST/)) {
    req.profiler = new this({route: req.raw.originalUrl.replace(/(&|\?)_ref=.*(&|$)/, ''), method: req.raw.method, host: req.hostname, events: [{label: 'Request', elapsed: 0}]})
    await req.profiler.save()
  }
{'fraction_non_alphanumeric': 0.1927710843373494, 'fraction_numerical': 0.011339475549255847, 'mean_word_length': 4.30827067669173, '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': '901545', 'n_tokens_mistral': 502, 'n_tokens_neox': 500, 'n_words': 123}