riemann.graphite

Forwards events to Graphite.

graphite

(graphite opts)

Returns a function which accepts an event and sends it to Graphite. Silently drops events when graphite is down. Attempts to reconnect automatically every five seconds. Use:

(graphite {:host “graphite.local” :port 2003})

Options:

  • :path A function which, given an event, returns the string describing the path of that event in graphite. graphite-path-percentiles by default.
  • :pool-size The number of connections to keep open. Default 4.
  • :reconnect-interval How many seconds to wait between attempts to connect. Default 5.
  • :claim-timeout How many seconds to wait for a graphite connection from the pool. Default 0.1.
  • :block-start Wait for the pool’s initial connections to open before returning.
  • :protocol Protocol to use. Either :tcp (default) or :udp.

graphite-metric

(graphite-metric event)

convert riemann metric value to graphite

graphite-path-basic

(graphite-path-basic event)

Constructs a path for an event. Takes the hostname fqdn, reversed, followed by the service, with spaces converted to dots.

graphite-path-percentiles

(graphite-path-percentiles event)

Like graphite-service-basic, but also converts trailing decimals like 0.95 to 95.

graphite-path-tags

(graphite-path-tags tags)

Returns a function which constructs a path for an event. Takes the service with spaces converted to dots, followed by the tags referenced in tags if they exists in the event.

Example:

(def graph (graphite {:path (graphite-path-tags [:host :rack])}))

{:host “foo” :service “api req” :rack “n1”}

will have this path: api.req;host=foo;rack=n1

GraphiteClient

protocol

members

close

(close client)

Cleans up (closes sockets etc.)

open

(open client)

Creates a Graphite client

send-line

(send-line client line)

Sends a formatted line to Graphite

send-lines

(send-lines client lines)

Sends a list of formatted lines to Graphite