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]
- type Hostname = String
- type Port = Int
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.
time :: Lens' a (Maybe 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.
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".
>>>
view state $ ev "service" (0 :: (Signed Int64))
Just "ok"
>>>
view service $ ev "service" (0 :: (Signed Int64))
Just "service"
>>>
view metric $ ev "service" (0 :: (Signed Int64)) :: Maybe (Signed Int64)
Just (Signed 0)
>>>
view tags $ ev "service" (0 :: (Signed Int64))
[]