One of my main fears as a developer is users complaining about slow page loads. Loading times directly affect both user experience and my bottom line, so I need a way to dig into the performance of my application to address this issue.
What are my options?
I can tail logs, but logs suck. The pile of numbers and text provide limited context and insight. Logs are more useful to identify errors. But in raw form, they’re impractical to observe the performance of my application. I need to spend time upfront to set log post-processing up and adding and extracting new metrics to and from logs quickly becomes a pain.
If only I had easy-to-use, free performance monitoring that gives me actionable graphs in 2 minutes…
That’s where Pup comes in.
Pup is fully open-source. To install it, type this at the command-line:
$ sh -c "$(curl -L http://dtdg.co/dd-agent-source)"
Then navigate to http://localhost:17125 and bam! Within seconds, you will see metrics streaming in real time.
Pup is designed for application metrics:
In addition to collecting system metrics, Pup faithfully collects and displays custom metrics. To do so it harnesses the power of StatsD, a metrics collector developed by Etsy. Pup comes with StatsD built-in; no need to reinvent the wheel.
To send custom metrics to Pup, you can use the dogstatsd library, which as you will see requires a grand total of 3 lines of code to instrument application code. This library comes in a number of flavors (python, ruby, php, etc.)
Here’s an example Ruby web application using Sinatra. First, we need to install the dogstatsd library:
The web application code:
Now to add Pup instrumentation:
And you’re done. As soon as the page is hit, you’ll see something like this in Pup:
That’s it! If you use Datadog, the first period creates a namespace to organize metrics under.
Here’s a 1 minute screencast summarizing the whole process:
Looking for more?
More thorough documentation on using DogstatsD can be found on docs.datadoghq.com.
To correlate metrics and events across your infrastructure, give Datadog a spin. It only takes a few minutes to get started.