• Stars
    star
    148
  • Rank 249,983 (Top 5 %)
  • Language
    Scala
  • License
    BSD 3-Clause "New...
  • Created about 13 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A metrics aggregator for Graphite

Metricsd

I am a metrics aggregator for Graphite that supports counters, histograms and meters.

I should be drop-in compatible with Etsy's statsd, although I add explicit support for meters (with the m type) and gauges (with the g type) and introduce the h (histogram) type as an alias for timers (ms). I make heavy use of Coda Hale / Yammer's Metrics library for the JVM, including its ability to flush to Graphite.

As with statsd, all values (excepting sample rate) are expected to be integers. Go forth and multiply.

Meters are assumed to be per-second.

Metrics will be published to Graphite in the form metrics.{counter,gauge,histogram,meter}.<metric name>.<metric>. Multiple metrics may be published by joining messages together with newlines (as with statsite).

In addition to the Metrics library, I owe a great deal of gratitude to statsd (both Etsy's and Flickr's) and James Golick's statsd.scala for paving the way, in my protocol and structure respectively.

Metric Types

Metrics are collected by sending UDP messages to metricsd on port 8125 (or whatever you've overridden it to be).

For testing purposes, you can use netcat:

echo "varietiesOfCheese:12|c" | nc -w 0 -u localhost 8125

When instrumenting your application, you'll probably want to use one of the statsd-compatible libraries.

Counters

Counters are incremented/decremented by sending messages of the form:

<metric name>:<value>|c

For example, to add 12 varieties to the "varietiesOfCheese" metric:

varietiesOfCheese:12|c

Counters may be updated at a lower sample rate; to do so, add |@<sample rate>, e.g.:

varietiesOfCheese:3|c|@0.25

N.B.: Counters are currently reset when metricsd starts up. If you need long-term historical values, you should use a gauge instead.

Gauges

Gauges are updated by sending messages of the form:

<metric name>:<value>|g

For example, to set the current value for "varietiesOfCheese":

varietiesOfCheese:27|g

As gauges do not have base their current value on previous values, they are more appropriate for storing metrics in a durable fashion (i.e. not susceptible to metricsd restarting).

Histograms

Histograms are updated by sending messages of the form:

<metric name>:<value>|h

For example:

responseTime:244|h

Again, values must be integers, so use a data-appropriate scale (e.g. milliseconds).

N.B.: Histograms will be reset (samples will be cleared) when metricsd restarts. Biased (ExponentiallyDecayingSample(1028, 0.015), Metrics' HistogramMetric.SampleType.BIASED, biasing the sample to the last 5 minutes) histograms are used to mitigate the impact of this.

Meters

Meters are updating by sending messages of the form:

<metric name>

For example:

userDidSignIn

Deleting Metrics

From time to time you may submit erroneous metrics or find that you're no longer interesting in tracking older metrics. Rather than restarting the server to clear metricsd's memory of them (and losing the state of your counters), you can send additional messages to delete them:

<metric name>:delete|<metric type>

For example, to delete a typo'd repsonseTime histogram:

repsonseTime:delete|h

This can also be done from the command line:

echo "repsonseTime:delete|h" | nc -w 0 -u localhost 8125

Management

metricsd provides a simple, text-based interface (telnet-like) interface to obtain information about known metrics. This interface runs on a separate port (8126 by default).

The following commands are supported:

  • help - Provides a list of known commands
  • counters - Lists known counters
  • gauges - Lists known gauges
  • histograms - Lists known histograms
  • meters - Lists known meters
  • quit - Closes the connection

Each command should be followed by a newline to execute.

For the commands that list metrics, each metric name will be followed by a newline and the list itself will be terminated by END with two newlines following.

echo "varietiesOfCheese:1|c" | nc -w 0 -u localhost 8125
echo "varietiesOfMice:2|c" | nc -w 0 -u localhost 8125
echo "cheeseEaten:2|h" | nc -w 0 -u localhost 8125

$ telnet localhost 8126
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
counters
varietiesOfMice
varietiesOfCheese
END

histograms
cheeseEaten
END

gauges 
END

quit
Connection closed by foreign host.

Running

To run metricsd, execute the JAR:

$ java -jar metricsd-<version>-jar-with-dependencies.jar

If you wish to provide a custom configuration:

$ CONFIG=/path/to/config.json java -jar metricsd-<version>-jar-with-dependencies.jar

Configuration

Configuration is done by providing the path to a JSON file similar to config/metricsd.json:

{
    "debug": false,
    "graphite": {
        "flushInterval": 10,
        "host": "localhost",
        "port": 2003
    },
    "log": {
        "level": "INFO",
        "file": "log/metricsd.log"
    },
    "port": 8125,
    "prefix": "metricsd",
    "managementPort": 8126
}

These are the default values; feel free to omit unchanged values from your configuration.

Installing

Seth is experimenting with maintaining a PPA for Ubuntu packages.

Building

Build Requirements

  • Scala 2.9.1
  • Maven 3.0.x

Begin by installing Scala and Maven according to the relevant instructions for your system.

To build a packaged JAR containing dependencies:

$ mvn package

Packages

Debian packaging lives in a bzr repository on Launchpad: ~mojodna/+junk/metricsd-package

License

Copyright (c) 2011 Seth Fitzsimmons

Published under the BSD License.

More Repositories

1

tessera

A tilelive-based tile server.
JavaScript
322
star
2

oauth-proxy

(in-use) An HTTP proxy for signing OAuth requests
Python
143
star
3

switchboard

(formerly-in-use) A toolkit for assembling XMPP clients and interacting with XMPP servers.
Ruby
135
star
4

marblecutter

Dynamic tiling of raster data for OpenAerialMap + others
Python
121
star
5

heroku-buildpack-jemalloc

Heroku buildpack with jemalloc
Shell
116
star
6

marblecutter-virtual

Virtual catalogs for marblecutter
Python
46
star
7

osm2orc

Transcodes OSM PBFs to ORC
Java
46
star
8

tl

An alternate command line interface to tilelive
JavaScript
38
star
9

heroku-buildpack-cairo

Heroku buildpack with Cairo (and Pixman and FreeType)
Makefile
34
star
10

fire-hydrant

(demo) Tools for consuming Fire Eagle's XMPP PubSub feed.
Ruby
32
star
11

osm-pds-pipelines

OSM PDS pipeline
JavaScript
30
star
12

sample-oauth-provider

A sample Rails OAuth provider that doesn't use oauth_plugin (or acts_as_authenticated)
Ruby
26
star
13

active_queue

A toolkit for queueing tasks and creating worker processes
Ruby
20
star
14

oauth-reverse-proxy

(proof-of-concept) A reverse HTTP proxy that verifies signed OAuth requests
Python
18
star
15

linq.js

Git mirror of http://linqjs.codeplex.com/
JavaScript
16
star
16

dovetail

(proof-of-concept) A toolkit for assembling XMPP components.
Ruby
14
star
17

mars

(proof-of-concept) REST over XMPP
Ruby
13
star
18

tilelive-http

An HTTP source for tilelive
JavaScript
12
star
19

marblecutter-tilezen

Python
12
star
20

tilelive-cache

A caching wrapper for tilelive.js
JavaScript
11
star
21

searchable

(formerly-in-use) Annotation-Driven Indexing and Searching with Lucene and Solr
Java
11
star
22

node-oauth-proxy

An HTTP proxy that signs OAuth 1.0a requests
JavaScript
10
star
23

heroku-buildpack-gdal

Heroku buildpack with GDAL
Shell
9
star
24

oauth-signpost

Git mirror of http://code.google.com/p/oauth-signpost/
Java
8
star
25

marblecutter-tools

Tools to process raster data for use with marblecutter
Shell
8
star
26

fireeagle-tutorial

Sample code for using Fire Eagle from Ruby and Python
Python
8
star
27

imap2atom

Create an Atom representation of an IMAP mailbox.
Ruby
7
star
28

marblecutter-openaerialmap

Python
7
star
29

tilelive-merge

A tilelive source that merges sources
JavaScript
7
star
30

placemaker-cli

Command-line interface for Y!'s Placemaker API
7
star
31

tilelive-tmstyle

JavaScript
7
star
32

tilelive-tmsource

A tilelive provider for TM2 sources.
JavaScript
6
star
33

mirror

Mirror SVN repositories to GitHub
Ruby
6
star
34

posm-imagery-api

POSM imagery API
Python
6
star
35

whirlycache

(formerly-in-use) [mirror] A fast, flexible in-process object cache for Java.
6
star
36

sawfish

(incomplete) Barebones Fire Eagle updater for Android
Java
5
star
37

log-nexus

A rebroadcasting syslog server
JavaScript
5
star
38

tilelive-rasterpbf

A tilelive source for outputting PBF-encoded rasters from PostGIS.
JavaScript
5
star
39

tilelive-carto

A Carto style source for tilelive
JavaScript
5
star
40

heroku-buildpack-mapnik

Heroku buildpack with Mapnik and its dependencies
Shell
5
star
41

jupiter

(proof-of-concept) A test bed for ActiveResource over XMPP
5
star
42

bamboo-shooter

(demo) PubSub for Pandas
Ruby
4
star
43

fireeagle-location-provider

Fire Eagle Location Provider for Google Gears
4
star
44

node-jersey

Bridges UDP packets onto the information superhighway.
JavaScript
4
star
45

anemone

Web Hook servicer / batch request system
Ruby
4
star
46

tilelive-xray

tilelive data tile visualization
JavaScript
4
star
47

tp

'tp: putting the tee in HTTP
JavaScript
4
star
48

node-metricsd

metricsd client for Node.js
JavaScript
4
star
49

crud_controller

Abstract resource controller + generator for Rails
4
star
50

tilelive-modules

A listing of known tilelive modules
JavaScript
4
star
51

node-fuse-leveldb

LevelDB-backed FUSE filesystem
JavaScript
4
star
52

geode-held

Geode-HELD + Fire Eagle support
JavaScript
4
star
53

tilelive-raster

tilelive source for simple rasters, both local and remote
JavaScript
4
star
54

planworld.rb

(preliminary) ruby port of Planworld
Ruby
3
star
55

overpass-diff-publisher

Convert Overpass augmented diffs to JSON
JavaScript
3
star
56

osm-replication-streams

OSM replication-related Node.js streams
JavaScript
3
star
57

changeset-replay-tool

JavaScript
3
star
58

lambda-layer-rasterio

Dockerfile
3
star
59

mapshaper-proxy

JavaScript
3
star
60

tilelive-mapbox

A tilelive.js source for mapbox:// URIs
JavaScript
3
star
61

heroku-buildpack-pgsql

Heroku buildpack with PostgreSQL binaries and libraries
Shell
3
star
62

tiled-vector-remix

Mix and match tiled vector layers
JavaScript
3
star
63

gatsby-remark-copy-images

Gatsby Plugin: Copies images referenced from markdown to your `public` folder.
JavaScript
3
star
64

sprout

(formerly-in-use) Annotation-Powered Simplicity for Struts 1.x
Java
3
star
65

tilelive-streaming

Streaming functionality for tilelive modules
JavaScript
3
star
66

mojodna.net

CSS
2
star
67

accelerometer

D3 accelerometer vis + Node websocket server
HTML
2
star
68

vector-tile-wizard

MVT rendering with Dropwizard and Processing
Java
2
star
69

mapnik-styles

(reference, experimental) Mapnik styles
2
star
70

httpclient-oauth

HttpComponent-compatible OAuth client implementation (WIP)
Java
2
star
71

flickr-shape-parser

(utility) Parses and converts the Flickr Shapefiles Public Dataset, Version 1.0
Python
2
star
72

AaronCam

Camera + Flickr app skeleton
Objective-C
2
star
73

mapnik-query-analyzer

Find layer bottlenecks in Mapnik stylesheets
JavaScript
2
star
74

marblecutter-land-cover

Marblecutter-powered land cover data rendering
Python
2
star
75

dji_fc300c

Calibration images for DJI FC300C (Phantom 3 Standard)
2
star
76

tilelive-leveldb

JavaScript
2
star
77

uv_check_sample.node

Node.js addon that demonstrates inconsistent uv_check_* behavior
C++
1
star
78

strava-cli

Strava command line client
JavaScript
1
star
79

firesnake

(demo) Python-powered Google Earth visualizer for Fire Eagle data
Python
1
star
80

node-locking-cache

A locking LRU cache
JavaScript
1
star
81

tilelive-cartodb

A tilelive source for CartoDB
JavaScript
1
star
82

docker-gdal

Curated versions of GDAL as Docker images
Dockerfile
1
star
83

node-strav3

Strava API (v3) client (Node.js)
JavaScript
1
star
84

tilelive-blend

A tilelive provider that blends.
JavaScript
1
star
85

tilelive-csvin

A streaming tilelive source for CSV inputs
JavaScript
1
star
86

node-heroku-runtime-metrics

Consumes Heroku log streams and emits metrics to metricsd
JavaScript
1
star
87

tilelive-null

A noop sink for tilelive
JavaScript
1
star
88

levels

Levels
1
star
89

node-fuse-mbtiles

FUSE filesystem for MBTiles
JavaScript
1
star
90

node-heroku-syslog-metricsd-bridge

A Heroku syslog drain that bridges to metricsd
JavaScript
1
star
91

marblecutter-lambda

Dynamic raster processing on AWS
Python
1
star
92

watercors

River gauge proxy
JavaScript
1
star
93

debian-mapnik

Mirror of git://git.debian.org/pkg-grass/mapnik.git
C++
1
star