riemann.transport.graphite

decode-graphite-line

(decode-graphite-line line tags)

Decode a line coming from graphite.

Graphite uses a simple scheme where each metric is given as a CRLF delimited line, whitespace split (space, tab) with three items:

  • The metric name
  • The metric value (optionally NaN)
  • The timestamp

Decode-graphite-line will yield a simple event with just a service, metric, and timestamp.

decode-graphite-service-tag

(decode-graphite-service-tag service)

Takes the service, converts it in a Clojure map with a :service key and a key for each Graphite tag.

graphite-frame-decoder

(graphite-frame-decoder parser-fn protocol tags)

Creates a netty MessageToMessage for graphite lines. Takes a parser-fn: a function which will transform events generated by the parser, prior to insertion into streams. This can be used when graphite metrics have known patterns that you wish to extract more information (host, refined service name, tags) from; to fill in default states or TTLs, and so on.

If parser-fn is nil, defaults to identity.

graphite-handler

(graphite-handler core stats ctx message)

Given a core, channel, and a message, applies the message to core.

graphite-server

(graphite-server)(graphite-server opts)

Start a graphite-server. Options:

  • :host “127.0.0.1”
  • :port 2003
  • :protocol :tcp or :udp (default :tcp)
  • :parser-fn an optional function to further transform events after decoding.
  • :tags converts Graphite tags into event attributes (default false)

tags->attributes

(tags->attributes tags)

Converts a sequence of Graphite tag (key=val) into a Clojure map.