<commit_before>package com.twitter.finagle.stats

import com.twitter.common.stats.Stats
import com.twitter.common.stats.Percentile
import com.twitter.common.base.Supplier

class CommonsStatsReceiver extends StatsReceiverWithCumulativeGauges {
  protected[this] def registerGauge(name: Seq[String], f: => Float) {
    Stats.STATS_PROVIDER.makeGauge(variableName(name), new Supplier[java.lang.Float] {
      def get = new java.lang.Float(f)
    })
  }

  protected[this] def deregisterGauge(name: Seq[String]) {
    // not implmented in commons
  }

  def counter(name: String*) = new Counter {
    private[this] val counter = Stats.exportLong(variableName(name))
    def incr(delta: Int) { counter.addAndGet(delta) }
  }

  def stat(name: String*) = new Stat {
    private[this] val percentile = new Percentile[java.lang.Float](variableName(name), 100.0f, 50, 95, 99)

    def add(value: Float) = synchronized {
      percentile.record(new java.lang.Float(value))
    }
  }

  private[this] def variableName(name: Seq[String]) = name mkString "_"
}
<commit_msg>[split] remove unneccessary explicit cast<commit_after>package com.twitter.finagle.stats

import com.twitter.common.stats.Stats
import com.twitter.common.stats.Percentile
import com.twitter.common.base.Supplier
import com.twitter.common.util.Sampler

class CommonsStatsReceiver extends StatsReceiverWithCumulativeGauges {
  protected[this] def registerGauge(name: Seq[String], f: => Float) {
    Stats.STATS_PROVIDER.makeGauge(variableName(name), new Supplier[java.lang.Float] {
      def get = new java.lang.Float(f)
    })
  }

  protected[this] def deregisterGauge(name: Seq[String]) {
    // not implmented in commons
  }

  def counter(name: String*) = new Counter {
    private[this] val counter = Stats.exportLong(variableName(name))
    def incr(delta: Int) { counter.addAndGet(delta) }
  }

  def stat(name: String*) = new Stat {
    val percentile = new Percentile[java.lang.Float](variableName(name), 100.0f , 50, 95, 99)

    def add(value: Float) = {
      percentile.record(value)
    }
  }

  private[this] def variableName(name: Seq[String]) = name mkString "_"
}

{'fraction_non_alphanumeric': 0.12242990654205607, 'fraction_numerical': 0.009345794392523364, 'mean_word_length': 4.312655086848635, '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': '4770045', 'n_tokens_mistral': 734, 'n_tokens_neox': 688, 'n_words': 147}