on master help sign in
Stackify
commitfdd7ff12faa3678ca5446585cb5f806b163ebbe0 authorMichael Xavier <michael@michaelxavier.net> dateMon 29 Feb 2016, 11:14 (11 years ago) parent7a1db5c
10 files changed+83−33
.gitignore+1 .travis.yml+40 katip-elasticsearch/addSources.sh−4 katip-elasticsearch/katip-elasticsearch.cabal+3−3 katip-elasticsearch/src/Katip/Scribes/ElasticSearch.hs+17−16 katip-elasticsearch/test/Main.hs+4−4 katip/katip.cabal+1−1 katip/src/Katip/Core.hs+4−4 katip/test/Katip/Tests.hs−1 stack.yaml+13
.gitignore+1
@@ -2,3 +2,4 @@
22dist
33cabal.sandbox.config
44TAGS
5+.stack-work/
.travis.ymlnew file+40
@@ -0,0 +1,40 @@
1+# Use new container infrastructure to enable caching
2+sudo: false
3+
4+# Choose a lightweight base image; we provide our own build tools.
5+language: c
6+
7+# GHC depends on GMP. You can add other dependencies here as well.
8+addons:
9+ apt:
10+ packages:
11+ - libgmp-dev
12+
13+# The different configurations we want to test. You could also do things like
14+# change flags or use --stack-yaml to point to a different file.
15+env:
16+- ARGS=""
17+- ARGS="--resolver lts-3"
18+- ARGS="--resolver lts"
19+- ARGS="--resolver nightly"
20+
21+before_install:
22+# Download and unpack the stack executable
23+- mkdir -p ~/.local/bin
24+- export PATH=$HOME/.local/bin:$PATH
25+- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
26+
27+# This line does all of the work: installs GHC if necessary, build the library,
28+# executables, and test suites, and runs the test suites. --no-terminal works
29+# around some quirks in Travis's terminal implementation.
30+script:
31+ - stack $ARGS setup
32+ - stack $ARGS --no-terminal test --haddock
33+ - stack $ARGS bench
34+ - stack $ARGS build
35+ - stack $ARGS sdist
36+
37+# Caching so the next build will be fast too.
38+cache:
39+ directories:
40+ - $HOME/.stack
katip-elasticsearch/addSources.shdeleted−4
@@ -1,4 +0,0 @@
1−set -e
2−cabal sandbox init
3−
4−cabal sandbox add-source ../katip
katip-elasticsearch/katip-elasticsearch.cabal+3−3
@@ -18,7 +18,7 @@ library
1818 Katip.Scribes.ElasticSearch
1919 Katip.Scribes.ElasticSearch.Annotations
2020 build-depends:
21− base >=4.6 && <4.9
21+ base >=4.6 && <5
2222 , katip
2323 , bloodhound >= 0.7.0.1 && < 0.11
2424 , random >= 1.0 && < 1.2
@@ -26,7 +26,7 @@ library
2626 , aeson >=0.6 && <0.11
2727 , stm >= 2.4.3 && < 2.5
2828 , stm-chans >= 3.0.0.2 && < 3.1
29− , async >= 2.0.1.0 && < 2.1
29+ , async >= 2.0.1.0 && < 2.2
3030 , enclosed-exceptions >= 1.0.0 && < 1.1
3131 , http-client
3232 , text
@@ -73,7 +73,7 @@ test-suite test
7373 , http-client
7474 , bloodhound
7575 , base
76− , tasty >= 0.10.1.2 && < 0.11
76+ , tasty >= 0.11
7777 , tasty-hunit
7878 , tasty-quickcheck
7979 , quickcheck-instances
katip-elasticsearch/src/Katip/Scribes/ElasticSearch.hs+17−16
@@ -30,7 +30,7 @@ module Katip.Scribes.ElasticSearch
3030
3131
3232-------------------------------------------------------------------------------
33−import Control.Applicative
33+import Control.Applicative as A
3434import Control.Concurrent
3535import Control.Concurrent.Async
3636import Control.Concurrent.STM.TBMQueue
@@ -193,7 +193,7 @@ chooseIxn :: IndexName -> IndexShardingPolicy -> Item a -> IndexName
193193chooseIxn (IndexName ixn) p i =
194194 IndexName (T.intercalate "-" (ixn:segs))
195195 where
196− segs = indexNameSegment <$> shardPolicySegs p i
196+ segs = indexNameSegment A.<$> shardPolicySegs p i
197197
198198
199199-------------------------------------------------------------------------------
@@ -277,18 +277,18 @@ mkEsScribe cfg@EsScribeCfg {..} server ix mapping sev verb = do
277277-------------------------------------------------------------------------------
278278baseMapping :: MappingName -> Value
279279baseMapping (MappingName mn) =
280− object [ mn .= object ["properties" .= object pairs] ]
281− where pairs = [ str "thread"
282− , str "sev"
283− , str "pid"
284− , str "ns"
285− , str "msg"
286− , "loc" .= locType
287− , str "host"
288− , str "env"
289− , "at" .= dateType
290− , str "app"
291− ]
280+ object [ mn .= object ["properties" .= object prs] ]
281+ where prs = [ str "thread"
282+ , str "sev"
283+ , str "pid"
284+ , str "ns"
285+ , str "msg"
286+ , "loc" .= locType
287+ , str "host"
288+ , str "env"
289+ , "at" .= dateType
290+ , str "app"
291+ ]
292292 str k = k .= object ["type" .= String "string"]
293293 locType = object ["properties" .= object locPairs]
294294 locPairs = [ str "loc_pkg"
@@ -305,7 +305,7 @@ baseMapping (MappingName mn) =
305305-------------------------------------------------------------------------------
306306-- | Handle both old-style aeson and picosecond-level precision
307307esDateFormat :: Text
308−esDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSSSSSZ"
308+esDateFormat = "yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ss.SSSZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSSSSSZ"
309309
310310
311311-------------------------------------------------------------------------------
@@ -369,7 +369,8 @@ startWorker EsScribeCfg {..} env mapping q = go
369369 sendLog :: IndexName -> Value -> IO ()
370370 sendLog ixn v = void $ recovering essRetryPolicy [handler] $ const $ do
371371 did <- mkDocId
372− runBH env $ indexDocument ixn mapping defaultIndexDocumentSettings v did
372+ res <- runBH env $ indexDocument ixn mapping defaultIndexDocumentSettings v did
373+ return res
373374 eat _ = return ()
374375 handler _ = Handler $ \e ->
375376 case fromException e of
katip-elasticsearch/test/Main.hs+4−4
@@ -9,7 +9,7 @@ module Main
99
1010
1111-------------------------------------------------------------------------------
12−import Control.Applicative
12+import Control.Applicative as A
1313import Control.Concurrent.STM
1414import Control.Lens hiding (mapping, (.=))
1515import Control.Monad
@@ -60,8 +60,8 @@ teardownSearch :: (Scribe, IO ()) -> IO ()
6060teardownSearch (_, finalizer) = do
6161 finalizer
6262 bh $ do
63− dropESSchema
64− dropESSTemplate
63+ when False $ dropESSchema
64+ when False $ dropESSTemplate --TODO: drop
6565
6666
6767-------------------------------------------------------------------------------
@@ -263,7 +263,7 @@ instance Arbitrary Value where
263263 , String <$> arbitrary
264264 , Number <$> (scientific <$> arbitrary <*> arbitrary)
265265 , Bool <$> arbitrary
266− , pure Null
266+ , A.pure Null
267267 ]
268268
269269
katip/katip.cabal+1−1
@@ -33,7 +33,7 @@ library
3333 TemplateHaskell
3434 OverloadedStrings
3535
36− build-depends: base >=4.5 && <4.9
36+ build-depends: base >=4.5 && <5
3737 , aeson >=0.6 && <0.11
3838 , auto-update >= 0.1 && < 0.2
3939 , bytestring >= 0.9 && < 0.11
katip/src/Katip/Core.hs+4−4
@@ -14,7 +14,7 @@
1414module Katip.Core where
1515
1616-------------------------------------------------------------------------------
17−import Control.Applicative
17+import Control.Applicative as A
1818import Control.AutoUpdate
1919import Control.Concurrent
2020import Control.Lens
@@ -33,7 +33,7 @@ import Control.Monad.Trans.Writer
3333import Data.Aeson (FromJSON (..), ToJSON (..),
3434 object)
3535import qualified Data.Aeson as A
36−import Data.Foldable (foldMap)
36+import Data.Foldable as FT
3737import qualified Data.HashMap.Strict as HM
3838import Data.List
3939import qualified Data.Map.Strict as M
@@ -394,7 +394,7 @@ sl a b = SimpleLogPayload [(a, AnyLogPayload b)]
394394-- | Constrain payload based on verbosity. Backends should use this to
395395-- automatically bubble higher verbosity levels to lower ones.
396396payloadObject :: LogItem a => Verbosity -> a -> A.Object
397−payloadObject verb a = case foldMap (flip payloadKeys a) [(V0)..verb] of
397+payloadObject verb a = case FT.foldMap (flip payloadKeys a) [(V0)..verb] of
398398 AllKeys -> toObject a
399399 SomeKeys ks -> HM.filterWithKey (\ k _ -> k `elem` ks) $ toObject a
400400
@@ -552,7 +552,7 @@ runKatipT le (KatipT f) = runReaderT f le
552552-- | Log with everything, including a source code location. This is
553553-- very low level and you typically can use 'logT' in its place.
554554logItem
555− :: (Applicative m, LogItem a, Katip m)
555+ :: (A.Applicative m, LogItem a, Katip m)
556556 => a
557557 -> Namespace
558558 -> Maybe Loc
katip/test/Katip/Tests.hs−1
@@ -69,7 +69,6 @@ deriving instance Arbitrary Namespace
6969deriving instance Arbitrary Environment
7070deriving instance Arbitrary ThreadIdText
7171deriving instance Arbitrary CPid
72−deriving instance Eq Loc
7372deriving instance Eq LogStr
7473deriving instance (Eq a) => Eq (Item a)
7574
stack.yamlnew file+13
@@ -0,0 +1,13 @@
1+resolver: lts-5.5
2+packages:
3+ - katip
4+ - katip-elasticsearch
5+extra-deps:
6+ - bloodhound-0.10.0.0
7+ - string-conv-0.1
8+ - aeson-0.10.0.0
9+flags:
10+ katip:
11+ lib-Werror: true
12+ katip-elasticsearch:
13+ lib-Werror: true