<commit_before>import javax.servlet.ServletContext

import com.socrata.balboa.server.{HealthCheckServlet, MainServlet, MetricsServlet}
import com.typesafe.scalalogging.StrictLogging
import org.scalatra.LifeCycle
import org.scalatra.metrics.MetricsBootstrap

class ScalatraBootstrap extends LifeCycle with MetricsBootstrap with StrictLogging {
  override def init(context: ServletContext): Unit = {
    logger.info("Assigning servlet handlers.")
    context.mount(new MainServlet, "/")
    context.mount(new MetricsServlet, "/metrics")
    context.mount(new HealthCheckServlet, "/health")
  }
}<commit_msg>Enable metrics reporting in balboa-http. (#150)<commit_after>import javax.servlet.ServletContext

import com.codahale.metrics.JmxReporter
import com.socrata.balboa.server.{HealthCheckServlet, MainServlet, MetricsServlet}
import com.typesafe.scalalogging.StrictLogging
import org.scalatra.LifeCycle
import org.scalatra.metrics.MetricsBootstrap

class ScalatraBootstrap extends LifeCycle with MetricsBootstrap with StrictLogging {
  /**
    * The reporter determines the destination of the metrics. Additionally, the
    * reporter determines units that the values are reported in. In this case,
    * metrics are made available as JMX properties, where our collectd
    * configuration will gather them and transmit them back to Graphite. Dig
    * into the JmxReporter source code for the units that are used.
    */
  val jmxReporter = JmxReporter.forRegistry(metricRegistry).build()

  override def init(context: ServletContext): Unit = {
    jmxReporter.start()

    logger.info("Assigning servlet handlers.")
    context.mount(new MainServlet, "/")
    context.mount(new MetricsServlet, "/metrics")
    context.mount(new HealthCheckServlet, "/health")
  }

  override def destroy(context: ServletContext): Unit = {
    super.destroy(context)
    jmxReporter.close()
  }
}
{'fraction_non_alphanumeric': 0.08617021276595745, 'fraction_numerical': 0.0015957446808510637, 'mean_word_length': 4.933753943217666, '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': '5622516', 'n_tokens_mistral': 538, 'n_tokens_neox': 525, 'n_words': 144}