       when req?.route?              then req.route.path
       else                               req.path
 
+    path = 'home'  if path is '/'
     @sanitizeMetricName "#{@prefix}.#{path}"
 
 

onHeaders            = require 'on-headers'
{ MetricsBase }      = require 'koding-datadog'

module.exports = class MetricsMiddleware extends MetricsBase


  @sanitizeMetricName : (string) ->

    return string
      .replace /[\/-]/g,               '.'     # replace all / with .
      .replace /\.{2,}/g,              '.'     # remove adjacent dots
      .replace /[^a-zA-Z0-9_\.]/g,     '_'     # replace invalid chars with _
