packages feed

ekg-json 0.1.0.6 → 0.1.1.0

raw patch · 3 files changed

+72/−25 lines, 3 filesdep ~aesondep ~basedep ~textnew-uploaderPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: aeson, base, text

API changes (from Hackage documentation)

Files

CHANGES.md view
@@ -1,3 +1,12 @@+## 0.1.1.0 (2024-07-30)++ * Support aeson 2+ * Support modern GHCs (8.10.7-9.8.2)++## 0.1.0.7 (2020-??-??)++ * TBD+ ## 0.1.0.6 (2017-07-31)   * GHC 8.2 support.
System/Metrics/Json.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE CPP #-}  -- | Encoding of ekg metrics as JSON. The encoding defined by the -- functions in this module are standardized and used by the ekg web@@ -22,6 +23,27 @@ import qualified System.Metrics as Metrics import qualified System.Metrics.Distribution as Distribution +#if MIN_VERSION_aeson(2,0,0)+import qualified Data.Aeson.Key as K+import qualified Data.Aeson.KeyMap as KM++type KeyMap = KM.KeyMap++insertMap :: T.Text -> v -> KeyMap v -> KeyMap v+insertMap = KM.insert . K.fromText++lookupMap :: T.Text -> KeyMap v -> Maybe v+lookupMap = KM.lookup . K.fromText+#else+type KeyMap = M.HashMap T.Text++insertMap :: T.Text -> v -> KeyMap v -> KeyMap v+insertMap = M.insert++lookupMap :: T.Text -> KeyMap v -> Maybe v+lookupMap = M.lookup+#endif+ ------------------------------------------------------------------------ -- * Converting metrics to JSON values @@ -54,11 +76,11 @@     build m name val = go m (T.splitOn "." name) val      go :: A.Value -> [T.Text] -> Metrics.Value -> A.Value-    go (A.Object m) [str] val      = A.Object $ M.insert str metric m+    go (A.Object m) [str] val      = A.Object $ insertMap str metric m       where metric = valueToJson val-    go (A.Object m) (str:rest) val = case M.lookup str m of-        Nothing -> A.Object $ M.insert str (go A.emptyObject rest val) m-        Just m' -> A.Object $ M.insert str (go m' rest val) m+    go (A.Object m) (str:rest) val = case lookupMap str m of+        Nothing -> A.Object $ insertMap str (go A.emptyObject rest val) m+        Just m' -> A.Object $ insertMap str (go m' rest val) m     go v _ _                        = typeMismatch "Object" v  typeMismatch :: String   -- ^ The expected type
ekg-json.cabal view
@@ -1,33 +1,49 @@-name:                ekg-json-version:             0.1.0.6-synopsis:            JSON encoding of ekg metrics+name:               ekg-json+version:            0.1.1.0+synopsis:           JSON encoding of ekg metrics description:   Encodes ekg metrics as JSON, using the same encoding as used by the   ekg package, thus allowing ekg metrics to be served by other HTTP   servers than the one used by the ekg package.-homepage:            https://github.com/tibbe/ekg-json-bug-reports:         https://github.com/tibbe/ekg-json/issues-license:             BSD3-license-file:        LICENSE-author:              Johan Tibell-maintainer:          johan.tibell@gmail.com-category:            Distribution-extra-source-files:  CHANGES.md-build-type:          Simple-cabal-version:       >=1.10 +homepage:           https://github.com/L0neGamer/ekg-json+bug-reports:        https://github.com/L0neGamer/ekg-json/issues+license:            BSD3+license-file:       LICENSE+author:             Johan Tibell+maintainer:+  Johan Tibell <johan.tibell@gmail.com>,+  Mikhail Glushenkov <mikhail.glushenkov@gmail.com>++category:           Distribution+extra-source-files: CHANGES.md+build-type:         Simple+cabal-version:      >=1.10+tested-with:+  GHC ==8.0.2+   || ==8.2.2+   || ==8.4.4+   || ==8.6.5+   || ==8.8.3+   || ==8.10.7+   || ==9.0.2+   || ==9.2.8+   || ==9.4.8+   || ==9.6.4+   || ==9.6.6+   || ==9.8.2+ library-  exposed-modules:-    System.Metrics.Json+  exposed-modules:  System.Metrics.Json   build-depends:-    aeson >=0.4 && < 1.3,-    base >= 4.5 && < 4.11,-    ekg-core >= 0.1 && < 0.2,-    text < 1.3,-    unordered-containers < 0.3+      aeson                 >=0.4 && <1.6  || >=2.0 && <2.3+    , base                  >=4.6 && <4.20+    , ekg-core              >=0.1 && <0.2+    , text                  <2.2+    , unordered-containers  <0.3    default-language: Haskell2010  source-repository head   type:     git-  location: https://github.com/tibbe/ekg-json.git+  location: https://github.com/L0neGamer/ekg-json.git