Blog

All posts by Drew Stephens

Advanced Metrics Tracking for Webapps

MetricCatcher is a bookkeeping agent for application metrics. It utilizes Coda Hale’s Metrics package to provide languages that aren’t Java (or aren’t long-running) with the easy-to-use tracking & advanced maths of Metrics.

If you have a Java app and are tracking its performance, the best way to do that is using Coda Hale’s Metrics package, which provides convenient objects for counting happenings in your application. In other languages you don’t have the option of using this great library, and in web apps that start up a new process for each request, simply keeping the persistent data to enable metrics like this is a hassle. That’s where MetricCatcher comes in—toss values at MetricCatcher and it will create corresponding Metric objects, allowing your non-Java app to take advantage of Coda Hale’s fancy maths. Metrics in a Java application can be viewed with Jconsole (or even better, VisualVM), but to really realize the power of tracking your application, MetricCatcher can pump its data into Graphite or Ganglia.

We use MetricCatcher to keep tabs on our PHP code using the Phetric library.  The combination of Phetric & MetricCatcher allows the easy creation & updating of metrics without requiring any state to be kept on the PHP side of things.

Running MetricCatcher

Grab MetricCatcher from the Clearspring GitHub repository for MetricCatcher

The only configuration that MetricCatcher requires is the location of your Ganglia or Graphite server, which can be defined in the conf/config.properties of the distribution. MetricCatcher will send metrics to whichever metrics servers are defined. Starting & stopping MetricCatcher can be done using the included scripts in the bin directory.

Getting Data In

MetricCatcher listens for JSON on UDP port 1420 for metrics to track—simply feed it lists of Metrics objects, each of which must have a name, type, timestamp, and value. MetricCatcher supports all of the types that Coda Hale’s Metrics provides, except for Health Checks. Note that histograms are either biased (favor more recent data) or uniform (weight all data equally) and are referred to as such. The JSON format looks like this:

{
    "name":"namespace.metric.name",
    "value":numeric_value,
    "type":"[gauge|counter|meter|biased|uniform|timer]",
    "timestamp":unix_time.millis
}

Metrics are sent as a JSON list, so multiple individual metrics can be bundled:

[
    {"name":"foo","value":7,"type":"gauge","timestamp":1320682297.6631},
    {"name":"bar","value":77,"type":"meter","timestamp":1320682297.6631}
]

Where Data Goes

You can view the metrics using a JMX agent (jConsole or VisualVM as mentioned above), but the best way toview them is to define a metrics—collecting server in the config.properties file. If you do that, MetricCatcher will send its stats there once a minute, so you can check out your Graphite or Ganglia server to see the results.

25 Hours of Racing

Last weekend the Clearspring Motor Club racing team, Cobra Kai, raced their Swedish Race Truck at Nelson Ledges Road Course in Ohio as part of the ChumpCar Longer Longest Day.  After 25 hours, 25 minutes, and 25 seconds of racing—stopping only to change drivers and refuel the car every 2 hours—the checker flag dropped with our car in 13th place overall, a great result from a field of 74 cars that started the race.

ChumpCar is a racing series similar to the 24 Hours of LeMons.  The premise is simple: buy a car for less than $500 and run it on a racetrack for hours on end.  The car that accumulates the most laps over the race is declared the winner.  This sort of “crap can” racing isn’t just orbiting a circle track, nor is it a demolition derby.  The tracks are complex and difficult to master.  The danger is real, too—we wear helmets, head-to-toe fire gear, all of the cars have full roll cages, and the safety rules are extensive.

In endurance racing the biggest factor is reliability.  As long as you can keep out on the track without problems you have the basis for a good race.  Performance can only take you so far and since the $500 price of the car includes any performance modifications, options there are limited.  Our team has made great use of cutting things off of the car to improve performance.  Before our first race we cut the springs and filled them with tennis balls to make the suspension stiffer.   At our second race, the ChumpCar 24 Hours at VIR, we turned the race wagon into a truck by chopping the roof off while waiting in line to get into the racetrack.  Our car’s performance from this weight-saving modification were enough to encourage another team at our most recent race to do the same with their Volvo.

Overall we had a great race without any problems that kept us off the track.  Ending up in 13th place—ahead of dozens of cars that were turning faster laps when they were on track—is an wonderful achievement.  For complete details on our race, check out this post on the CS Motor Club blog.  Next time, we’re shooting for the top ten!

Think this is awesome?  Check out the jobs page, we’re always looking for new drivers folks at Clearspring.

Clearspring To The Races!

Cobra Kai Race Wagon with lights

Like any great company, Clearspring has a motorsports division that fields a racing team.  The Clearspring Motor Club team, Cobra Kai, ran its first race, the 2011 Capitol Offense at Summit Point Raceway in West Virginia a few weeks ago, ending up in 44th place of 102 runners.  Given that this was most of the team’s first experience with wheel-to-wheel racing, and we were driving a just-completed race wagon in its first race, this was a great result.  For those who don’t know, the 24 Hours of LeMons is a whimsical race series that begins with the premise of making racing, a notoriously expensive sport, relatively cheap and accessible.  The central rule is that all of the cars, sans safety equipment, are worth less than $500, which leads to lots of awful vehicles that you wouldn’t believe are roadworthy, much less could be driven on a racetrack for 14 hours.

Cobra Kai Race Wagon on track

This weekend we’re stepping things up a bit and participating in the Chump Car VIR 24, a bona-fide 24-hour, through-the-night race.  This is everyone’s first time doing night racing, which we have been informed is a harrowing experience of barely following the dark racetrack with never-sufficient lights.  So if you like racing, keep an eye on the Clearspring Motor Club blog, follow us on Twitter, or just check out the highlight video from our last race.  And if you are interested in working at a sweet company that has a race team (and more!), then head over to the Clearspring jobs page and see if there is something that fits the bill.

New Analytics Feature: Alerts

At AddThis, we’re always trying to make our analytics more informative and useful. This week we’re adding a feature to help keep you abreast of changes in your site’s traffic: email alerts. Alerts notify you by email when there are significant changes to the rate of shares or traffic. Alerts can be set up for specific URLs on your site, a specific domain, or all domains in an AddThis profile.

The new alerts management interface

AddThis alerts have a couple of great uses. First, like our analytics emails, they can help you keep a pulse on the the overall state of sharing for your sites—with domain-wide alerts you can be on top of any noteworthy change in your site’s traffic.

Perhaps the more powerful way to use alerts is setting one for a specific page that you’re interested in.  Say you’re making a new blog post and you want to know what the Social Web thinks of your literary masterpiece. Create an alert for the post’s URL and we’ll let you know when it goes viral. You’ll find a link to create an alert at the top of every content detail report.

To learn more about setting alerts, check out this help page, or head over to Settings to get started.