riemann-0.1.0.0: A Riemann client for Haskell

Safe HaskellNone
LanguageHaskell2010

Network.Monitoring.Riemann.Types

Synopsis

Documentation

class HasState a where Source

HasState types (e.g. Event and State) have information representing the state of a service on a host at a given time. These shared types give rise to restrictedly polymorphic lenses.

Methods

time :: Lens' a (Maybe (Signed Int64)) Source

The time of the event, in unix epoch seconds

state :: Lens' a (Maybe Text) Source

Any string less than 255 bytes, e.g. "ok", "warning", "critical"

service :: Lens' a (Maybe Text) Source

e.g. "API port 8000 reqs/sec"

host :: Lens' a (Maybe Text) Source

A hostname, e.g. "api1", "foo.com"

description :: Lens' a (Maybe Text) Source

Freeform text

tags :: Lens' a [Text] Source

Freeform list of strings, e.g. ["rate", "fooproduct", "transient"]

ttl :: Lens' a (Maybe Float) Source

A floating-point time, in seconds, that this event is considered valid for. Expired states may be removed from the index.

class AMetric a where Source

The class of types which can be interpreted as metrics for an Event.

Methods

metric :: Lens' Event (Maybe a) Source

class HasQuery a where Source

HasQuery types contain a Riemann query inside them somewhere. This class provides query as a polymorphic lens toward that query.

Methods

query :: Lens' a (Maybe Text) Source

data Event Source

Event is a description of an application-level event, emitted to Riemann for indexing.

data Msg Source

Msg is a wrapper for sending/receiving multiple States, Events, or a single Query.

ev :: AMetric a => String -> a -> Event Source

Create a simple Event with state "ok".

>>> get state $ ev "service" (0 :: (Signed Int64))
Just "ok"
>>> get service $ ev "service" (0 :: (Signed Int64))
Just "service"
>>> get metric $ ev "service" (0 :: (Signed Int64)) :: Maybe (Signed Int64)
Just 0
>>> get tags $ ev "service" (0 :: (Signed Int64))
[]