title: Collecting Application Metrics in Java (optionally .Net)
body: <p>I want to be able to expose various time and count based metrics dynamically from my applications. Perf4j works out pretty well for the time ones but does not allow for count in a straightforward way that I'm aware of.</p>
  
  <p>for instance I can do</p>
  
  <pre><code>StopWatch dbWriteTime = new Log4JStopWatch("ServiceName:DBWrite");
  dbWriteTime.start();
  ... execute DB stuff here
  dbWriteTime.stop();
  </code></pre>
  
  <p>and you can set these metrics to get logged at whatever interval and it does a great job of that. But sometimes I want to do something like</p>
  
  <pre><code>Metric metric = new Metric("ServiceName:OrdersPerRequest");
  metric.put(50);
  </code></pre>
  
  <p>I could call the perf4j timer lib 50 times but that is a horrible and inefficient hack to get my metrics in the log. Does anyone know a good open source library that can do both types of metrics? Also if it could monitor the output metric logs and dump them to a centralized DB that would be great. Additionally if you know of a good open source web front end to graph and display this sort of data I'd be very interested in that. It seems this must be something a lot of people have needed before.</p>