-onHeaders            = require 'on-headers'
-{ MetricsBase }      = require 'koding-datadog'
+onFinished      = require 'on-finished'
+{ MetricsBase } = require 'koding-datadog'
 
 module.exports = class MetricsMiddleware extends MetricsBase
 

  @sanitizeMetricName : (string) ->

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

    return tags


  @metricsOnFinished : (opts) ->

    return {
      increment         :
