<commit_before>package org.scalatra.metrics

import java.util.concurrent.Callable
import com.codahale.metrics._
import nl.grons.metrics.scala._
import org.scalatra.ScalatraBase

trait MetricsSupport {
  self: ScalatraBase ⇒

  protected def metricsRegistry = Metrics.metricRegistry

  def metricName(name: String) = MetricName(name)

  def timer[A](name: String)(thunk: => A) = metricsRegistry.timer(name).time { new Callable[A] { def call(): A = thunk } }
  def counter(name: String) = metricsRegistry.counter(name)
  def histogram(name: String) = metricsRegistry.histogram(name)
  def meter(name: String) = metricsRegistry.meter(name)
}<commit_msg>Fixed metrics<commit_after>package org.scalatra.metrics

import java.util.concurrent.Callable
import com.codahale.metrics._
import nl.grons.metrics.scala._
import org.scalatra.ScalatraBase

trait MetricsSupport extends nl.grons.metrics.scala.InstrumentedBuilder {
  self: ScalatraBase ⇒

  val metricsRegistry = Metrics.metricRegistry

  def metricName(name: String) = MetricName(name)

  def timer[A](name: String)(thunk: => A) = metrics.timer(name).time { new Callable[A] { def call(): A = thunk } }
  def counter(name: String) = metrics.counter(name)
  def histogram(name: String) = metrics.histogram(name)
  def meter(name: String) = metrics.meter(name)
  def gauge(name: String) = metrics.gauge(name)
}
{'fraction_non_alphanumeric': 0.11864406779661017, 'fraction_numerical': 0.0, 'mean_word_length': 5.436018957345971, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7059029', 'n_tokens_mistral': 439, 'n_tokens_neox': 430, 'n_words': 98}