katip-elasticsearch 0.6.0.0 → 0.7.0.0
raw patch · 7 files changed
+61/−22 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Katip.Scribes.ElasticSearch: defaultEsScribeCfg :: EsScribeCfg ESV1
+ Katip.Scribes.ElasticSearch: defaultEsScribeCfg :: EsScribeCfg ESV5
- Katip.Scribes.ElasticSearch.Internal: defaultEsScribeCfg :: EsScribeCfg ESV1
+ Katip.Scribes.ElasticSearch.Internal: defaultEsScribeCfg :: EsScribeCfg ESV5
Files
- bench/Main.hs +3/−3
- changelog.md +10/−0
- examples/example.hs +1/−1
- katip-elasticsearch.cabal +1/−4
- src/Katip/Scribes/ElasticSearch.hs +5/−0
- src/Katip/Scribes/ElasticSearch/Internal.hs +18/−7
- test/Main.hs +23/−7
bench/Main.hs view
@@ -15,11 +15,11 @@ import Data.Proxy (Proxy (..)) import System.Random import qualified Data.Text as T-import Database.V1.Bloodhound.Types+import Database.Bloodhound.Types import Numeric ------------------------------------------------------------------------------- import Katip.Scribes.ElasticSearch-import Katip.Scribes.ElasticSearch.Internal (ESV1)+import Katip.Scribes.ElasticSearch.Internal (ESV5) ------------------------------------------------------------------------------- main :: IO ()@@ -34,7 +34,7 @@ mkDocIdBenchmark :: Benchmark mkDocIdBenchmark = bgroup "mkDocId" [- bench "mkDocId (randomIO)" $ nfIO (mkDocId (Proxy :: Proxy ESV1))+ bench "mkDocId (randomIO)" $ nfIO (mkDocId (Proxy :: Proxy ESV5)) , bench "mkDocId' (shared )" $ nfIO mkDocId' ]
changelog.md view
@@ -1,3 +1,13 @@+0.7.0.0+=======+* Make compatible with unreleased bloodhound 0.17+* Deprecate use of ES version 1 which has been removed from bloodhound+ 0.17. All users should move over to ESV5 which should work for+ versions 5 and up.+* Default configuration to ESV5+* Add deprecation warnings for ESV1. Support for ESV1 will be removed+ in the future.+ 0.6.0.0 ======= * Update to katip-0.8.0.0 `PermitFunc` convention. To update, for
examples/example.hs view
@@ -6,7 +6,7 @@ ------------------------------------------------------------------------------- import Control.Exception-import Database.V5.Bloodhound+import Database.Bloodhound import Network.HTTP.Client ------------------------------------------------------------------------------- import Katip
katip-elasticsearch.cabal view
@@ -1,7 +1,7 @@ name: katip-elasticsearch synopsis: ElasticSearch scribe for the Katip logging framework. description: See README.md for more details.-version: 0.6.0.0+version: 0.7.0.0 license: BSD3 license-file: LICENSE author: Ozgun Ataman, Michael Xavier@@ -107,8 +107,5 @@ , stm , bytestring , tagged-- if flag(lib-Werror)- ghc-options: -Wall -Werror ghc-options: -threaded -rtsopts
src/Katip/Scribes/ElasticSearch.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- | Includes a scribe that can be used to log structured, JSON log -- messages to ElasticSearch. These logs can be explored easily using -- <https://www.elastic.co/products/kibana kibana> or your tool of@@ -67,12 +68,16 @@ , essIndexSettings , essIndexSharding , defaultEsScribeCfg+#if !MIN_VERSION_bloodhound(0,17,0) , defaultEsScribeCfgV1+#endif , defaultEsScribeCfgV5 -- ** Version-Proxied APIS -- $versionproxies , defaultEsScribeCfg'+#if !MIN_VERSION_bloodhound(0,17,0) , ESV1+#endif , ESV5 -- * Utilities , mkDocId
src/Katip/Scribes/ElasticSearch/Internal.hs view
@@ -28,7 +28,7 @@ import Data.Aeson import Data.ByteString.Lazy (ByteString) import Data.List.NonEmpty (NonEmpty (..))-import Data.Monoid ((<>))+import Data.Monoid as Monoid import Data.Text (Text) import qualified Data.Text as T import qualified Data.Text.Encoding as T@@ -37,8 +37,12 @@ import Data.Typeable as Typeable import Data.UUID import qualified Data.UUID.V4 as UUID4+#if MIN_VERSION_bloodhound(0,17,0)+import qualified Database.Bloodhound as V5+#else import qualified Database.V1.Bloodhound as V1 import qualified Database.V5.Bloodhound as V5+#endif import Network.HTTP.Client import Network.HTTP.Types.Status import Text.Printf (printf)@@ -95,7 +99,7 @@ -- * DailyIndexSharding defaultEsScribeCfg' :: ESVersion v => proxy v -> EsScribeCfg v defaultEsScribeCfg' prx = EsScribeCfg {- essRetryPolicy = exponentialBackoff 25000 <> limitRetries 5+ essRetryPolicy = exponentialBackoff 25000 Monoid.<> limitRetries 5 , essQueueSize = EsQueueSize 1000 , essPoolSize = EsPoolSize 2 , essAnnotateTypes = False@@ -104,19 +108,22 @@ } ++ ---------------------------------------------------------------------------------- | Alias of 'defaultEsScribeCfgV1' to minimize API+-- | Alias of 'defaultEsScribeCfgV5' to minimize API -- breakage. Previous versions of katip-elasticsearch only supported--- ES version 1.-defaultEsScribeCfg :: EsScribeCfg ESV1-defaultEsScribeCfg = defaultEsScribeCfgV1+-- ES version 1 and defaulted to it.+defaultEsScribeCfg :: EsScribeCfg ESV5+defaultEsScribeCfg = defaultEsScribeCfgV5 -------------------------------------------------------------------------------+#if !MIN_VERSION_bloodhound(0,17,0) -- | EsScribeCfg that will use ElasticSearch V1 defaultEsScribeCfgV1 :: EsScribeCfg ESV1 defaultEsScribeCfgV1 = defaultEsScribeCfg' (Typeable.Proxy :: Typeable.Proxy ESV1)-+#endif ------------------------------------------------------------------------------- -- | EsScribeCfg that will use ElasticSearch V5@@ -484,8 +491,11 @@ +#if !MIN_VERSION_bloodhound(0,17,0) data ESV1 = ESV1+{-# DEPRECATED ESV1 "ESV1 is deprecated and removed in bloodhound >= 0.17.0" #-} + instance ESVersion ESV1 where type BHEnv ESV1 = V1.BHEnv type IndexSettings ESV1 = V1.IndexSettings@@ -524,6 +534,7 @@ [ "type" .= String "string" , "index" .= String "analyzed" ]+#endif data ESV5 = ESV5
test/Main.hs view
@@ -34,8 +34,12 @@ import Data.Time.Calendar.WeekDate import Data.Typeable as Typeable import qualified Data.Vector as V+#if MIN_VERSION_bloodhound(0,17,0)+import qualified Database.Bloodhound as V5+#else import qualified Database.V1.Bloodhound as V1 import qualified Database.V5.Bloodhound as V5+#endif import Network.HTTP.Client import Network.HTTP.Types.Status import Test.QuickCheck.Instances ()@@ -54,8 +58,10 @@ main = defaultMainWithIngredients ings $ askOption $ \vers -> testGroup "katip-elasticsearch" [ case vers of- TestV1 -> esTests (Typeable.Proxy :: Typeable.Proxy ESV1)- TestV5 -> esTests (Typeable.Proxy :: Typeable.Proxy ESV5)+#if !MIN_VERSION_bloodhound(0,17,0)+ TestV1 -> esTests (Typeable.Proxy :: Typeable.Proxy ESV1)+#endif+ TestV5 -> esTests (Typeable.Proxy :: Typeable.Proxy ESV5) , typeAnnotatedTests , roundToSundayTests ]@@ -64,18 +70,26 @@ --------------------------------------------------------------------------------data TestWithESVersion = TestV1- | TestV5- deriving (Typeable)+data TestWithESVersion = TestV5+#if !MIN_VERSION_bloodhound(0,17,0)+ | TestV1+#endif+ deriving (Typeable) instance IsOption TestWithESVersion where- defaultValue = TestV1+ defaultValue = TestV5+#if !MIN_VERSION_bloodhound(0,17,0) parseValue "1" = Just TestV1+#endif parseValue "5" = Just TestV5 parseValue _ = Nothing optionName = Tagged "es-version"- optionHelp = Tagged "Version of ES to test against, either 1 or 5, defaulting to 1."+#if MIN_VERSION_bloodhound(0,17,0)+ optionHelp = Tagged "Version of ES to test against, either 1 or 5, defaulting to 5."+#else+ optionHelp = Tagged "Version of ES to test against, only v5 is supported, but should work for higher versions."+#endif class ESVersion v => TestESVersion v where@@ -101,6 +115,7 @@ searchByIndex :: proxy v -> IndexName v -> Search v -> BH v IO (Response ByteString) +#if !MIN_VERSION_bloodhound(0,17,0) instance TestESVersion ESV1 where type Server ESV1 = V1.Server toServer _ = V1.Server@@ -122,6 +137,7 @@ refreshIndex _ = V1.refreshIndex withBH _ = V1.withBH searchByIndex _ = V1.searchByIndex+#endif instance TestESVersion ESV5 where