Safe Haskell | None |
---|---|
Language | Haskell2010 |
Build an event which can then be sent to Riemann using a Client
Events are built by composing helper functions that set Riemann fields and applying to one of the Event constructors:
E.ok "my service" & E.description "my description" & E.metric (length [ "some data" ]) & E.ttl 20 & E.tags ["tag1", "tag2"]
With this design you are encouraged to create an event with one of ok
, warn
or failure
.
This has been done because we found that it is best to avoid services like my.service.success
and my.service.error
(that's what the Riemann state field is for).
You can use your own states using E.info & E.state "trace"
however this is discouraged as it doesn't show up nicely in riemann-dash.
- type Service = String
- type State = String
- type Event = Event
- emptyEvent :: Event
- toField :: String -> Maybe Utf8
- info :: Service -> Event
- state :: State -> Event -> Event
- ok :: Service -> Event
- warn :: Service -> Event
- failure :: Service -> Event
- description :: String -> Event -> Event
- class Metric a where
- metric :: Metric a => a -> Event -> Event
- ttl :: Float -> Event -> Event
- tags :: [String] -> Event -> Event
- attributes :: [Attribute] -> Event -> Event
- attribute :: String -> Maybe String -> Attribute
- withDefaults :: Seq Event -> IO (Seq Event)
- addTimeAndHost :: Int64 -> String -> Event -> Event
Documentation
emptyEvent :: Event Source #
metric :: Metric a => a -> Event -> Event Source #
Note that since Riemann's protocol has separate types for integers, floats and doubles, you need to specify which type you are using. For example, this won't work:
metric 1 myEvent
Instead use:
metric (1 :: Int) myEvent
attributes :: [Attribute] -> Event -> Event Source #