2014-04-11 15:04:34 +00:00
|
|
|
module System.Remote.Json
|
|
|
|
(
|
|
|
|
encodeAll
|
|
|
|
, encodeOne
|
|
|
|
) where
|
|
|
|
|
|
|
|
import qualified Data.Aeson.Encode as A
|
|
|
|
import qualified Data.ByteString.Lazy as L
|
|
|
|
|
|
|
|
import System.Metrics
|
2015-07-31 14:34:43 +00:00
|
|
|
import qualified System.Metrics.Json as Json
|
2014-04-11 15:04:34 +00:00
|
|
|
|
2015-07-31 14:34:43 +00:00
|
|
|
-- | Encode metrics as nested JSON objects. See 'Json.sampleToJson'
|
|
|
|
-- for a description of the encoding.
|
2014-04-11 15:04:34 +00:00
|
|
|
encodeAll :: Sample -> L.ByteString
|
2015-07-31 14:34:43 +00:00
|
|
|
encodeAll = A.encode . Json.sampleToJson
|
2014-04-11 15:04:34 +00:00
|
|
|
|
2015-07-31 14:34:43 +00:00
|
|
|
-- | Encode metric a JSON object. See 'Json.valueToJson'
|
|
|
|
-- for a description of the encoding.
|
2014-04-11 15:04:34 +00:00
|
|
|
encodeOne :: Value -> L.ByteString
|
2015-07-31 14:34:43 +00:00
|
|
|
encodeOne = A.encode . Json.valueToJson
|