@@ -258,6 +258,18 @@ module Database.Bloodhound.Types
258 , NodeName(..)
258 , NodeName(..)
259 , ClusterName(..)
259 , ClusterName(..)
260 , NodesInfo(..)
260 , NodesInfo(..)
263+ , NodeBreakerStats(..)
265+ , NodeTransportStats(..)
267+ , NodeNetworkStats(..)
268+ , NodeThreadPoolsStats(..)
270+ , NodeProcessStats(..)
272+ , NodeIndicesStats(..)
261 , EsAddress(..)
273 , EsAddress(..)
262 , PluginName(..)
274 , PluginName(..)
263 , NodeInfo(..)
275 , NodeInfo(..)
@@ -3841,6 +3853,58 @@ data NodesInfo = NodesInfo {
3841 , nodesClusterName :: ClusterName
3853 , nodesClusterName :: ClusterName
3842 } deriving (Eq, Show, Generic, Typeable)
3854 } deriving (Eq, Show, Generic, Typeable)
3856+data NodesStats = NodesStats {
3857+ nodesStats :: [NodeStats]
3858+ , nodesStatsClusterName :: ClusterName
3859+ } deriving (Eq, Show, Generic, Typeable)
3861+data NodeStats = NodeStats {
3862+ nodeStatsName :: NodeName
3863+ , nodeStatsFullId :: FullNodeId
3864+ , nodeStatsParentBreaker :: NodeBreakerStats
3865+ , nodeStatsRequestBreaker :: NodeBreakerStats
3866+ , nodeStatsFieldDataBreaker :: NodeBreakerStats
3867+ , nodeStatsHTTP :: NodeHTTPStats
3868+ , nodeStatsTransport :: NodeTransportStats
3869+ , nodeStatsFS :: NodeFSStats
3870+ , nodeStatsNetwork :: NodeNetworkStats
3871+ , nodeStatsThreadPool :: NodeThreadPoolsStats
3872+ , nodeStatsJVM :: NodeJVMStats
3873+ , nodeStatsProcess :: NodeProcessStats
3874+ , nodeStatsOS :: NodeOSStats
3875+ , nodeStatsIndices :: NodeIndicesStats
3876+ } deriving (Eq, Show, Generic, Typeable)
3878+data NodeBreakerStats = NodeBreakerStats
3879+ deriving (Eq, Show, Generic, Typeable)
3881+data NodeHTTPStats = NodeHTTPStats
3882+ deriving (Eq, Show, Generic, Typeable)
3884+data NodeTransportStats = NodeTransportStats
3885+ deriving (Eq, Show, Generic, Typeable)
3887+data NodeFSStats = NodeFSStats
3888+ deriving (Eq, Show, Generic, Typeable)
3890+data NodeNetworkStats = NodeNetworkStats
3891+ deriving (Eq, Show, Generic, Typeable)
3893+data NodeThreadPoolsStats = NodeThreadPoolsStats
3894+ deriving (Eq, Show, Generic, Typeable)
3896+data NodeJVMStats = NodeJVMStats
3897+ deriving (Eq, Show, Generic, Typeable)
3899+data NodeProcessStats = NodeProcessStats
3900+ deriving (Eq, Show, Generic, Typeable)
3902+data NodeOSStats = NodeOSStats
3903+ deriving (Eq, Show, Generic, Typeable)
3905+data NodeIndicesStats = NodeIndicesStats
3906+ deriving (Eq, Show, Generic, Typeable)
3844-- | A quirky address format used throughout ElasticSearch. An example
3908-- | A quirky address format used throughout ElasticSearch. An example
3845-- would be inet[/1.1.1.1:9200]. inet may be a placeholder for a
3909-- would be inet[/1.1.1.1:9200]. inet may be a placeholder for a
3846-- <https://en.wikipedia.org/wiki/Fully_qualified_domain_name FQDN>.
3910-- <https://en.wikipedia.org/wiki/Fully_qualified_domain_name FQDN>.
@@ -4360,6 +4424,64 @@ instance FromJSON NodesInfo where
4360 cn <- o .: "cluster_name"
4424 cn <- o .: "cluster_name"
4361 return (NodesInfo infos cn)
4425 return (NodesInfo infos cn)
4427+instance FromJSON NodesStats where
4428+ parseJSON = withObject "NodesStats" parse
4431+ nodes <- o .: "nodes"
4432+ stats <- forM (HM.toList nodes) $ \(fullNID, v) -> do
4433+ node <- parseJSON v
4434+ parseNodeStats (FullNodeId fullNID) node
4435+ cn <- o .: "cluster_name"
4436+ return (NodesStats stats cn)
4438+instance FromJSON NodeBreakerStats where
4439+ parseJSON _ = pure NodeBreakerStats
4441+instance FromJSON NodeHTTPStats where
4442+ parseJSON _ = pure NodeHTTPStats
4444+instance FromJSON NodeTransportStats where
4445+ parseJSON _ = pure NodeTransportStats
4447+instance FromJSON NodeFSStats where
4448+ parseJSON _ = pure NodeFSStats
4450+instance FromJSON NodeNetworkStats where
4451+ parseJSON _ = pure NodeNetworkStats
4453+instance FromJSON NodeThreadPoolsStats where
4454+ parseJSON _ = pure NodeThreadPoolsStats
4456+instance FromJSON NodeJVMStats where
4457+ parseJSON _ = pure NodeJVMStats
4459+instance FromJSON NodeProcessStats where
4460+ parseJSON _ = pure NodeProcessStats
4462+instance FromJSON NodeOSStats where
4463+ parseJSON _ = pure NodeOSStats
4465+instance FromJSON NodeIndicesStats where
4466+ parseJSON _ = pure NodeIndicesStats
4468+parseNodeStats :: FullNodeId -> Object -> Parser NodeStats
4469+parseNodeStats fnid o = do
4470+ breakers <- o .: "breakers"
4471+ NodeStats <$> o .: "name"
4473+ <*> breakers .: "parent"
4474+ <*> breakers .: "request"
4475+ <*> breakers .: "fielddata"
4477+ <*> o .: "transport"
4480+ <*> o .: "thread_pool"
4364parseNodeInfo :: FullNodeId -> Object -> Parser NodeInfo
4486parseNodeInfo :: FullNodeId -> Object -> Parser NodeInfo
4365parseNodeInfo nid o =
4487parseNodeInfo nid o =