stasd & graphite - measure anything, measure everything
TRANSCRIPT
Measure Anything, Measure EverythingStatsD & Graphite
By Avi Revivo / 2015
New development checklist Code standards Comments Logic Error handling Testable code Logging What is missing?
What about? Feature usage Performance Business KPIs
So why is it not there?2 main reasons
#1 ComplexityIt’s just not simple enough
#2 Understanding the Developer’s Role“Dear Engineers, Your job is not to write code. I know. You think you were hired to write code. In fact, your entire interview process centered around how well you could write code. And I’m sure you do it really well.
But it’s not your job. Your job is to improve our product for our users.”
Blog post Link
Let’s focus on complexityHow simple should it be? Dead simple!As simple as writing a log line…
Meet StatsD A network service that runs on the Node.js that listens for statistics, like counters and timers, sent over UDP or TCP and sends aggregates to one or more pluggable backend services.
Example: Sending a Metric
echo "foo:1|c" | nc -u -w0 127.0.0.1 8125
<metricname>:<value>|<type>
Key Concepts Buckets - Each stat is in its own "bucket". They
are not predefined anywhere. Values - Each stat will have a value. Flush - After the flush interval timeout, stats are
aggregated and sent to an upstream backend service.
Available Metric TypesCountin
g
gorets:1|c
Timing
glork:320|ms|@0.1
Gauges
gaugor:333|g
Sets
uniques:765|s
Sampling supported
Meet Graphite An all-in-one solution for storing and visualizing realtime time-series data in an efficient manner.
Graphite ArchitectureGraphite
Web A powerful
dashboard for our metrics and
a powerful plotting API.
CarbonThe core of Graphite. It
consists of set of three processes that take care of
receiving incoming data, aggregating it
and persisting it to disk.
Whisper
An efficient time-series
based database.
Understanding CarbonCarbon's job is to make that data available for real-time graphing immediately and try to get it stored on disk as fast as possible.It support configurable data persistency rules and full control over the way data is aggregated.
Carbon Retention Rules
For a timespan of 6 hours I want to store my data in intervals of 10 seconds.
For a timespan of 7 days I want to store my data in intervals of 1 minute.
For a timespan of 1 year I want to store my data in intervals of 1 hour.
For a timespan of 5 year I want to store my data in intervals of 24 hours.
[counts]Pattern = \.count$ retentions = 10s:6h;1m:7d;1h:1y,1d:5y
Carbon Aggregation Rules[sum]Pattern= \.count$aggregationMethod = sum
stats.app.users.logins.countstats.app.emails.sent.count
Avergage, Min, Max etc.
DEMO