title: What are java libraries for collecting/storing/presenting application metrics/statistics?
body: <p>I have a Java application that needs to collect and report a large number of metrics/operational measurements/statistics (different words for different people - I'll just use metrics) about various entities. Metrics can be one of:</p>
  
  <ol>
  <li>Some measured numerical value at a particular point in time (number of users currently logged onto the system, % utilization of some resource)</li>
  <li>Some measured numerical value over a given time interval (number of messages transmitted in the last 5mins)</li>
  <li>Some enumeration value at a particular point in time (Health status of some entity is ONLINE/WARNING/FAILED/OFFLINE)</li>
  </ol>
  
  <p>'Entities' can be physical devices (a computer, a switch, a modem) but are most often logical entities (Communication channel 4567, User 123456, interface to service A). Additionally, some of these logical entities are static in that they are known ahead of time and don't change during the life of the application, and others may be transient (communcation channel 4567 may only exist for some time, and then is deleted).</p>
  
  <p><strong>I'm looking for libraries to help solve 2 problems:</strong></p>
  
  <ol>
  <li>Make it easier to collect and store these bits of information on the server.</li>
  <li>Present the data to a user in a useful fashion.</li>
  </ol>
  
  <p>Note/Requirements:</p>
  
  <ol>
  <li>The server application producing the data is basically a Java process running as a daemon (ie not a webapp)</li>
  <li>There will be 2 different types of clients. 
  <ol>
  <li>One is a Java Swing desktop application where most of the 'heavy' use will be. Rich live charting and historical querying abilities are important here.</li>
  <li>The other is a web UI. My requirements are not 100% clear here yet, but the needs of this client will be considerably lighter than the swing client. Open standards are needed here (AJAX/HTML not Flash)</li>
  </ol></li>
  <li>Can be deployed embedded in proprietary software (ie, no GPL License). Commercial or free.</li>
  </ol>
  
  <p>In the past, my company has attempted a couple of 'home-grown' solutions for this need. Basically the data is shoved into a database in some inconsistent fashion, and the client pulls the data out and is able to chart a single value over a fixed period of time using either home grown or 3rd party charting packages. Frankly, all of our solutions have sucked. Some of the problems I hope a 3rd party solution could fix would be:</p>
  
  <ol>
  <li>Encapsulate the code used to update/record the metric so that it doesn't polute the class that is actually measuring the value.</li>
  <li>Help manage the naming/identifying of the metrics. There can easily be 1000s of them; coming up with some kind of naming scheme myself to ensure uniqueness is a PITA.</li>
  <li>Deal with historical data nicely. Being able to configure how long data is kept and either archiving or purging old records.</li>
  <li>On the client side, built-in charting and querying ability, with the ability to transform some of the raw data from the database before being presented to the user.</li>
  </ol>
  
  <p>Sorry for the long description. Thanks for your help.</p>