<commit_before>Metrics
=======

*Capturing and exposing application metrics via JMX. For funsies.*

Requirements
------------

* Java SE 6
* Scala 2.8 Beta1


How To Use
----------

**First**, specify Metrics as a dependency:

    val codaRepo = "Coda Hale's Repository" at "http://repo.codahale.com/"
    val metrics = "com.yammer" % "metrics" % "1.0" withSources()

(Or whatever it takes for you to get Maven or Ivy happy.)

**Second**, instrument your classes:

    import com.yammer.metrics.{Counter, Meter, Timer}
    
    class ThingFinder {
      private val resultsMeter = new Meter
      private val dbTimer = new Timer
      
      def findThings() = {
        val results = dbTimer.time {
          // perform an action which gets timed
          Database.query("WHOO")
        }
        
        // calculate the rate of new things found
        resultsMeter.mark(results.size)
        
        // etc.
      }
    }

**Third**, expose these metrics via JMX:
    
    import java.util.concurrency.TimeUnit<commit_msg>Fix dependency reference.<commit_after>Metrics
=======

*Capturing and exposing application metrics via JMX. For funsies.*

Requirements
------------

* Java SE 6
* Scala 2.8 Beta1


How To Use
----------

**First**, specify Metrics as a dependency:

    val codaRepo = "Coda Hale's Repository" at "http://repo.codahale.com/"
    val metrics = "com.yammer" % "metrics_2.8.0.Beta1" % "1.0" withSources()

(Or whatever it takes for you to get Maven or Ivy happy.)

**Second**, instrument your classes:

    import com.yammer.metrics.{Counter, Meter, Timer}
    
    class ThingFinder {
      private val resultsMeter = new Meter
      private val dbTimer = new Timer
      
      def findThings() = {
        val results = dbTimer.time {
          // perform an action which gets timed
          Database.query("WHOO")
        }
        
        // calculate the rate of new things found
        resultsMeter.mark(results.size)
        
        // etc.
      }
    }

**Third**, expose these metrics via JMX:
    
    import java.util.concurrency.TimeUnit
{'fraction_non_alphanumeric': 0.12103746397694524, 'fraction_numerical': 0.007684918347742555, 'mean_word_length': 2.1704718417047184, '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': '5022184', 'n_tokens_mistral': 641, 'n_tokens_neox': 612, 'n_words': 201}