@@ -62,6 +62,7 @@ module Database.Bloodhound.Types
6262 , MonadBH(..)
6363 , Version(..)
6464 , VersionNumber(..)
65+ , MaybeNA(..)
6566 , BuildHash(..)
6667 , Status(..)
6768 , Existence(..)
@@ -4064,7 +4065,7 @@ data NodeOSStats = NodeOSStats {
40644065 , nodeOSCPUIdle :: Int
40654066 , nodeOSCPUUser :: Int
40664067 , nodeOSCPUSys :: Int
4067− , nodeOSLoad :: LoadAvgs
4068+ , nodeOSLoad :: Maybe LoadAvgs
40684069 , nodeOSUptime :: NominalDiffTime
40694070 , nodeOSTimestamp :: UTCTime
40704071 } deriving (Eq, Show, Generic, Typeable)
@@ -4189,7 +4190,7 @@ data NodePluginInfo = NodePluginInfo {
41894190 , nodePluginJVM :: Bool
41904191 -- ^ Is this plugin running on the JVM
41914192 , nodePluginDescription :: Text
4192− , nodePluginVersion :: VersionNumber
4193+ , nodePluginVersion :: MaybeNA VersionNumber
41934194 , nodePluginName :: PluginName
41944195 } deriving (Eq, Show, Generic, Typeable)
41954196
@@ -4875,7 +4876,7 @@ instance FromJSON NodeOSStats where
48754876 swap <- o .: "swap"
48764877 mem <- o .: "mem"
48774878 cpu <- o .: "cpu"
4878− load <- o .: "load_average"
4879+ load <- o .:? "load_average"
48794880 NodeOSStats <$> swap .: "free_in_bytes"
48804881 <*> swap .: "used_in_bytes"
48814882 <*> mem .: "actual_used_in_bytes"
@@ -5044,11 +5045,11 @@ parseNodeInfo nid o =
50445045instance FromJSON NodePluginInfo where
50455046 parseJSON = withObject "NodePluginInfo" parse
50465047 where
5047− parse o = NodePluginInfo <$> o .: "site"
5048− <*> o .: "jvm"
5049− <*> o .: "description"
5048+ parse o = NodePluginInfo <$> o .: "site"
5049+ <*> o .: "jvm"
5050+ <*> o .: "description"
50505051 <*> o .: "version"
5051− <*> o .: "name"
5052+ <*> o .: "name"
50525053
50535054instance FromJSON NodeHTTPInfo where
50545055 parseJSON = withObject "NodeHTTPInfo" parse
@@ -5212,3 +5213,10 @@ instance FromJSON NodeNetworkInterface where
52125213 parse o = NodeNetworkInterface <$> o .: "mac_address"
52135214 <*> o .: "name"
52145215 <*> o .: "address"
5216+
5217+newtype MaybeNA a = MaybeNA { unMaybeNA :: Maybe a }
5218+ deriving (Show, Eq)
5219+
5220+instance FromJSON a => FromJSON (MaybeNA a) where
5221+ parseJSON (String "NA") = pure $ MaybeNA Nothing
5222+ parseJSON o = MaybeNA . Just <$> parseJSON o