Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class HasState a where
- class AMetric a where
- class HasQuery a where
- data State
- data Event
- data Query
- data Msg
- ev :: AMetric a => String -> a -> Event
- once :: Lens' State (Maybe Bool)
- attributes :: Lens' Event (Map Text Text)
- data MsgState
- msgState :: Lens' Msg MsgState
- states :: Lens' Msg [State]
- events :: Lens' Msg [Event]
Documentation
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.
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
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.
The class of types which can be interpreted as metrics for an
Event
.
Event
is a description of an application-level event, emitted
to Riemann for indexing.
Query
is a question to be made of the Riemann index.
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))
[]