packages feed

ridley 0.3.1.4 → 0.3.2.0

raw patch · 3 files changed

+11/−9 lines, 3 filesdep ~prometheus

Dependency ranges changed: prometheus

Files

ridley.cabal view
@@ -1,5 +1,5 @@ name:                ridley-version:             0.3.1.4+version:             0.3.2.0 synopsis:            Quick metrics to grow your app strong. description:         Please see README.md homepage:            https://github.com/iconnect/ridley#README@@ -42,7 +42,7 @@                        mtl,                        shelly,                        transformers,-                       prometheus,+                       prometheus > 0.5.0 && < 2.2.1,                        raw-strings-qq,                        microlens,                        microlens-th,
src/System/Metrics/Prometheus/Ridley/Types.hs view
@@ -166,7 +166,7 @@ newtype RidleyT t a = Ridley { unRidley :: ReaderT RidleyOptions t a }   deriving (Functor, Applicative, Monad, MonadReader RidleyOptions, MonadIO, MonadTrans) -type Ridley = RidleyT (P.RegistryT (KatipT IO))+type Ridley = RidleyT (P.RegistryT (KatipContextT IO))  data RidleyCtx = RidleyCtx {     _ridleyThreadId   :: ThreadId@@ -177,11 +177,18 @@  instance Katip Ridley where   getLogEnv = Ridley $ lift (lift getLogEnv)+  localLogEnv f (Ridley (ReaderT m)) =+    Ridley $ ReaderT $ \env -> P.RegistryT (localLogEnv f $ P.unRegistryT (m env))  instance KatipContext Ridley where   getKatipContext   = return mempty   getKatipNamespace = _logEnvApp <$> Ridley (lift $ lift (getLogEnv))+  localKatipContext f (Ridley (ReaderT m)) =+    Ridley $ ReaderT $ \env -> P.RegistryT (localKatipContext f $ P.unRegistryT (m env))+  localKatipNamespace f (Ridley (ReaderT m)) =+    Ridley $ ReaderT $ \env -> P.RegistryT (localKatipNamespace f $ P.unRegistryT (m env))  -------------------------------------------------------------------------------- runRidley :: RidleyOptions -> LogEnv -> Ridley a -> IO a-runRidley opts le ridley = (runReaderT $ unKatipT $ P.evalRegistryT $ (runReaderT $ unRidley ridley) opts) le+runRidley opts le (Ridley ridley) =+  (runKatipContextT le (mempty :: SimpleLogPayload) mempty $ P.evalRegistryT $ (runReaderT ridley) opts)
test/Spec.hs view
@@ -80,11 +80,6 @@         r <- getRegistry >>= sample         Map.null (unRegistrySample r) @?= False         containsMetrics 8701 [ "# TYPE wai_request_count counter"-                             , "# TYPE wai_response_status_1xx counter"-                             , "# TYPE wai_response_status_2xx counter"-                             , "# TYPE wai_response_status_3xx counter"-                             , "# TYPE wai_response_status_4xx counter"-                             , "# TYPE wai_response_status_5xx counter"                              ]    , withResource (startRidleyWith 8702 [Network]) (\(_, ctx) -> killThread (ctx ^. ridleyThreadId)) $ \setupFn -> do