moonshine-2.0.0.0: A web service framework for Haskell, similar in purpose to dropwizard.

Safe HaskellNone
LanguageHaskell2010

Web.Moonshine

Synopsis

Documentation

runMoonshine :: Moonshine a -> IO a Source

Execute an insance of the Moonshine monad. This starts up a server and never returns.

route :: [(ByteString, Moonshine ())] -> Moonshine () Source

Like route, but that automatically sets up metrics for the specified routes.

makeTimer :: Text -> Moonshine Timer Source

Make a new timer with the given name.

timerAdd :: (Real time, MonadIO io) => Timer -> time -> io () Source

Add a time to a timer.

data Timer Source

The Timer type.

timed Source

Arguments

:: Text

The name of the timer.

-> Moonshine a

The action to be wrapped.

-> Moonshine a 

Wrap a Moonshine in a timer, so that timing data for invocations will be logged to the metrics handler.

liftSnap :: Snap () -> Moonshine () Source

Lifts a snap action into a moonshine action.

liftIO :: MonadIO m => forall a. IO a -> m a

Lift a computation from the IO monad.

setBanner :: String -> IO () Source

Sets the banner that moonshine should display on startup.

timedIO :: MonadIO io => Timer -> io a -> io a Source

Time how long it takes to perform some kind of IO. This function is compatible with any MonadIO.

makeGauge :: Text -> Moonshine Gauge Source

Create a new gauge with the given name.

gaugeInc :: MonadIO io => Gauge -> io () Source

Add one to a gauge value.

gaugeDec :: MonadIO io => Gauge -> io () Source

Subtract one from a gauge value.

gaugeSet :: MonadIO io => Gauge -> Int64 -> io () Source

Set the gauge the a specific value one from a gauge value.

gaugeAdd :: MonadIO io => Gauge -> Int64 -> io () Source

Add a value to a gauge.

gaugeSubtract :: MonadIO io => Gauge -> Int64 -> io () Source

Subtrace a value from a gauge.

data Gauge Source

The Gauge type.