f-o-a-m / kepler

A Haskell framework that facilitates writing ABCI applications
https://kepler.dev
Apache License 2.0
34 stars 9 forks source link

Sketch Metrics Effect #138

Closed IvantheTricourne closed 4 years ago

IvantheTricourne commented 4 years ago

We should add a Metrics effect to the SDK. This effect should be able to update counts (number of times a message type appears) and the amount of time an action takes. Additionally, we would want to be able to log metrics (similar to console logging):

data Metrics m a where
  -- | Increments the count of a specific message
  IncCount :: CountName -> Metrics m ()
  -- | Times an action
  WithTimer :: m a -> Metrics m (a, NominalDiffTime)

UPDATE: metrics won't have logging. Interpreter will be responsible for taking summands to a prometheus. Other summands should be added to support this interface (i.e., getCount, observeHistogram, getHistogram).

IvantheTricourne commented 4 years ago

see WIP: https://github.com/f-o-a-m/hs-abci/tree/carl/middleware-stats-and-scribes