instrument-0.6.0.0: Easy stats/metrics instrumentation for Haskell programs
Safe HaskellNone
LanguageHaskell2010

Instrument.Utils

Synopsis

Documentation

formatDecimal Source #

Arguments

:: RealFloat a 
=> Int

Digits after the point

-> Bool

Add thousands sep?

-> a

Number

-> Text 

showT :: Show a => a -> Text Source #

collect :: Ord b => [a] -> (a -> b) -> (a -> c) -> Map b [c] Source #

encodeCompress :: SafeCopy a => a -> ByteString Source #

Serialize and compress with GZip in that order. This is the only function we use for serializing to Redis.

decodeCompress :: (SafeCopy a, Serialize a) => ByteString -> Either String a Source #

Decompress from GZip and deserialize in that order. Tries to decode SafeCopy first and falls back to Serialize if that fails to account for old data. Note that encodeCompress only serializes to SafeCopy so writes will be updated.

indefinitely :: String -> Int -> IO () -> IO () Source #

Run an IO repeatedly with the given delay in microseconds. If there are exceptions in the inner loop, they are logged to stderr, prefixed with the given string context and retried at an exponential backoff capped at 60 seconds between.

seconds :: Int -> Int Source #

Convert seconds to microseconds

milliseconds :: Int -> Int Source #

Convert milliseconds to microseconds

for :: Functor f => f a -> (a -> b) -> f b Source #