summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkfine <>2017-05-05 12:24:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2017-05-05 12:24:00 (GMT)
commit364675b4ebf2d2c6b68460c08a75c3531dd5cea7 (patch)
treeabe159cc04f7a49ec6d2b438351698cb046b02b3
parent1bf18b12c85009eb225134f4376982e1d549d11f (diff)
version 0.3.140.3.14
-rwxr-xr-xShakefile.hs4
-rw-r--r--src/Network/AWS/Wolf/Act.hs4
-rw-r--r--src/Network/AWS/Wolf/Ctx.hs13
-rw-r--r--src/Network/AWS/Wolf/Decide.hs4
-rw-r--r--wolf.cabal2
5 files changed, 17 insertions, 10 deletions
diff --git a/Shakefile.hs b/Shakefile.hs
index f292d70..e5bc0df 100755
--- a/Shakefile.hs
+++ b/Shakefile.hs
@@ -37,8 +37,8 @@ main = shakeMain $ do
-- | sanity
--
fake "." pats "sanity" $ const $
- need [ fakeFile "build-error", fakeFile "lint" ]
+ need [ "build-error", "lint" ]
-- | Default things to run.
--
- want [ fakeFile "sanity", fakeFile "format" ]
+ want [ "sanity", "format" ]
diff --git a/src/Network/AWS/Wolf/Act.hs b/src/Network/AWS/Wolf/Act.hs
index 0a0845c..2a1b459 100644
--- a/src/Network/AWS/Wolf/Act.hs
+++ b/src/Network/AWS/Wolf/Act.hs
@@ -69,7 +69,7 @@ act queue command =
t0 <- liftIO getCurrentTime
(token, uid, input) <- pollActivity
t1 <- liftIO getCurrentTime
- statsCount "wolf.act.poll.count" (1 :: Int) [ "queue" =. queue ]
+ statsIncrement "wolf.act.poll.count" [ "queue" =. queue ]
statsHistogram "wolf.act.poll.elapsed" (realToFrac (diffUTCTime t1 t0) :: Double) [ "queue" =. queue ]
maybe_ token $ \token' ->
maybe_ uid $ \uid' ->
@@ -91,7 +91,7 @@ act queue command =
t3 <- liftIO getCurrentTime
traceInfo "finish" [ "output" .= output ]
let status = textFromString $ maybe "complete" (const "fail") e
- statsCount "wolf.act.activity.count" (1 :: Int) [ "queue" =. queue, "status" =. status ]
+ statsIncrement "wolf.act.activity.count" [ "queue" =. queue, "status" =. status ]
statsHistogram "wolf.act.activity.elapsed" (realToFrac (diffUTCTime t3 t2) :: Double) [ "queue" =. queue ]
diff --git a/src/Network/AWS/Wolf/Ctx.hs b/src/Network/AWS/Wolf/Ctx.hs
index 2651640..84cd289 100644
--- a/src/Network/AWS/Wolf/Ctx.hs
+++ b/src/Network/AWS/Wolf/Ctx.hs
@@ -28,7 +28,14 @@ import Network.HTTP.Types
catcher :: MonadStatsCtx c m => SomeException -> m a
catcher e = do
traceError "exception" [ "error" .= displayException e ]
- statsCount "wolf.exception" (1 :: Int) mempty
+ throwIO e
+
+-- | Like catcher, but with stats.
+--
+catcher' :: MonadStatsCtx c m => SomeException -> m a
+catcher' e = do
+ traceError "exception" [ "error" .= displayException e ]
+ statsIncrement "wolf.exception" [ "reason" =. show e ]
throwIO e
-- | Run configuration context.
@@ -41,7 +48,7 @@ runConfCtx conf action = do
, "prefix" .= (conf ^. cPrefix)
]
c <- view statsCtx <&> cPreamble <>~ preamble
- runTransT (ConfCtx c conf) $ catch action catcher
+ runTransT (ConfCtx c conf) $ catch action catcher'
-- | Update configuration context's preamble.
--
@@ -84,7 +91,7 @@ preAmazonStoreCtx preamble action = do
throttled :: MonadAmazon c m => m a -> m a
throttled action = do
traceError "throttled" mempty
- statsCount "wolf.throttled" (1 :: Int) mempty
+ statsIncrement "wolf.throttled" mempty
liftIO $ threadDelay $ 5 * 1000000
catch action $ throttler action
diff --git a/src/Network/AWS/Wolf/Decide.hs b/src/Network/AWS/Wolf/Decide.hs
index be1a84d..580911b 100644
--- a/src/Network/AWS/Wolf/Decide.hs
+++ b/src/Network/AWS/Wolf/Decide.hs
@@ -96,7 +96,7 @@ decide p =
t0 <- liftIO getCurrentTime
(token, hes) <- pollDecision
t1 <- liftIO getCurrentTime
- statsCount "wolf.decide.poll.count" (1 :: Int) [ "queue" =. queue ]
+ statsIncrement "wolf.decide.poll.count" [ "queue" =. queue ]
statsHistogram "wolf.decide.poll.elapsed" (realToFrac (diffUTCTime t1 t0) :: Double) [ "queue" =. queue ]
maybe_ token $ \token' ->
runAmazonDecisionCtx p hes $ do
@@ -106,7 +106,7 @@ decide p =
completeDecision token'
t3 <- liftIO getCurrentTime
traceInfo "finish" mempty
- statsCount "wolf.decide.decision.count" (1 :: Int) [ "queue" =. queue ]
+ statsIncrement "wolf.decide.decision.count" [ "queue" =. queue ]
statsHistogram "wolf.decide.decision.elapsed" (realToFrac (diffUTCTime t3 t2) :: Double) [ "queue" =. queue ]
-- | Run decider from main with config file.
diff --git a/wolf.cabal b/wolf.cabal
index 54cfadf..ce15f78 100644
--- a/wolf.cabal
+++ b/wolf.cabal
@@ -1,5 +1,5 @@
name: wolf
-version: 0.3.13
+version: 0.3.14
synopsis: Amazon Simple Workflow Service Wrapper.
description: Wolf is a wrapper around Amazon Simple Workflow Service.
homepage: https://github.com/swift-nav/wolf