git.iko.soy/typeable/bloodhound
on master help sign in
Wrap VersionNumber and LoadAvgs in Maybe #138
commit7ffb3d2fdef1307b0b9c5731909edac89a9bdc67 authorJosh Berman <berman.josh@gmail.com> dateThu 22 Sep 2016, 16:39 (10 years ago) parentbc02cc7
1 file changed+8−8
src/Database/Bloodhound/Types.hs+8−8
src/Database/Bloodhound/Types.hs+8−8
@@ -4064,7 +4064,7 @@ data NodeOSStats = NodeOSStats {
40644064 , nodeOSCPUIdle :: Int
40654065 , nodeOSCPUUser :: Int
40664066 , nodeOSCPUSys :: Int
4067− , nodeOSLoad :: LoadAvgs
4067+ , nodeOSLoad :: Maybe LoadAvgs
40684068 , nodeOSUptime :: NominalDiffTime
40694069 , nodeOSTimestamp :: UTCTime
40704070 } deriving (Eq, Show, Generic, Typeable)
@@ -4189,7 +4189,7 @@ data NodePluginInfo = NodePluginInfo {
41894189 , nodePluginJVM :: Bool
41904190 -- ^ Is this plugin running on the JVM
41914191 , nodePluginDescription :: Text
4192− , nodePluginVersion :: VersionNumber
4192+ , nodePluginVersion :: Maybe VersionNumber
41934193 , nodePluginName :: PluginName
41944194 } deriving (Eq, Show, Generic, Typeable)
41954195
@@ -4875,7 +4875,7 @@ instance FromJSON NodeOSStats where
48754875 swap <- o .: "swap"
48764876 mem <- o .: "mem"
48774877 cpu <- o .: "cpu"
4878− load <- o .: "load_average"
4878+ load <- (Just <$> o .: "load_average" <|> pure Nothing)
48794879 NodeOSStats <$> swap .: "free_in_bytes"
48804880 <*> swap .: "used_in_bytes"
48814881 <*> mem .: "actual_used_in_bytes"
@@ -5044,11 +5044,11 @@ parseNodeInfo nid o =
50445044instance FromJSON NodePluginInfo where
50455045 parseJSON = withObject "NodePluginInfo" parse
50465046 where
5047− parse o = NodePluginInfo <$> o .: "site"
5048− <*> o .: "jvm"
5049− <*> o .: "description"
5050− <*> o .: "version"
5051− <*> o .: "name"
5047+ parse o = NodePluginInfo <$> o .: "site"
5048+ <*> o .: "jvm"
5049+ <*> o .: "description"
5050+ <*> (Just <$> (o .: "version") <|> pure Nothing)
5051+ <*> o .: "name"
50525052
50535053instance FromJSON NodeHTTPInfo where
50545054 parseJSON = withObject "NodeHTTPInfo" parse