Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

StatsD/Graphite Naming Conventions for Metrics

I'm beginning the process of instrumenting a web application, and using StatsD to gather as many relevant metrics as possible. For instance, here are a few examples of the high-level metric names I'm currently using:

http.responseTime
http.status.4xx
http.status.5xx
view.renderTime
oauth.begin.facebook
oauth.complete.facebook
oauth.time.facebook
users.active

...and there are many, many more. What I'm grappling with right now is establishing a consistent hierarchy and set of naming conventions for the various metrics, so that the current ones make sense and that there are logical buckets within which to add future metrics.

My question is two fold:

  1. What relevant metrics are you gathering that you have found indespensible?
  2. What naming structure are you using to categorize metrics?
like image 678
Jared Hanson Avatar asked Aug 07 '13 15:08

Jared Hanson


People also ask

How do you name metrics?

Universal: Metric names are made up of words separated by underscores. Words use only lowercase letters and numbers (7bit ASCII). Metrics names should start with a letter. Any other punctuation or symbols are proscribed as they might have special use in a downstream system.

Is StatsD push or pull?

StatsD is an example of a monitoring system where the application pushes the metrics to the system.

What is StatsD used for?

StatsD is a front-end proxy originally written by Etsy's Erik Kastnen in Node. js, to collect metrics from instrumented code. Learn how to use #StatsD to instrument your #Golang #NodeJS or #Python code with custom metrics. And multiple client implementations that will allow us to instrument our applications as well.


1 Answers

This is a question that has no definitive answer but here's how we do it at Datadog (we are a hosted monitoring service so we tend to obsess over these things).

1. Which metrics are indispensable? It depends on the beholder. But at a high-level, for each team, any metric that is as close to their goals as possible (which may not be the easiest to gather).

System metrics (e.g. system load, memory etc.) are trivial to gather but seldom actionable because they are too hard to reliably connect them to a probable cause.

On the other hand number of completed product tours matter to anyone tasked with making sure new users are happy from the first minute they use the product. StatsD makes this kind of stuff trivially easy to collect.

We have also found that the core set of key metrics for any teamchanges as the product evolves so there is a continuous editorial process.

Which in turn means that anyone in the company needs to be able to pick and choose which metrics matter to them. No permissions asked, no friction to get to the data.

2. Naming structure The highest level of hierarchy is the product line or the process. Our web frontend is internally called dogweb so all the metrics from that component are prefixed with dogweb.. The next level of hierarchy is the sub-component, e.g. dogweb.db., dogweb.http., etc. The last level of hierarchy is the thing being measured (e.g. renderTime or responseTime).

The unresolved issue in graphite is the encoding of metric metadata in the metric name (and selection using *, e.g. dogweb.http.browser.*.renderTime) It's clever but can get in the way.

We ended up implementing explicit metadata in our data model, but this is not in statsd/graphite so I will leave the details out. If you want to know more, contact me directly.

like image 95
Alexis Lê-Quôc Avatar answered Oct 07 '22 15:10

Alexis Lê-Quôc