@@ -259,6 +259,26 @@ module Database.Bloodhound.Types
259259 , NodeName(..)
260260 , ClusterName(..)
261261 , NodesInfo(..)
262+ , NodesStats(..)
263+ , NodeStats(..)
264+ , NodeBreakersStats(..)
265+ , NodeBreakerStats(..)
266+ , NodeHTTPStats(..)
267+ , NodeTransportStats(..)
268+ , NodeFSStats(..)
269+ , NodeDataPathStats(..)
270+ , NodeFSTotalStats(..)
271+ , NodeNetworkStats(..)
272+ , NodeThreadPoolsStats(..)
273+ , NodeThreadPoolStats(..)
274+ , NodeJVMStats(..)
275+ , JVMBufferPoolStats(..)
276+ , JVMGCStats(..)
277+ , JVMPoolStats(..)
278+ , NodeProcessStats(..)
279+ , NodeOSStats(..)
280+ , LoadAvgs(..)
281+ , NodeIndicesStats(..)
262282 , EsAddress(..)
263283 , PluginName(..)
264284 , NodeInfo(..)
@@ -593,7 +613,7 @@ data InitialShardCount = QuorumShards
593613
594614data NodeAttrFilter = NodeAttrFilter { nodeAttrFilterName :: NodeAttrName
595615 , nodeAttrFilterValues :: NonEmpty Text}
596− deriving (Eq, Read, Show, Generic, Ord)
616+ deriving (Eq, Read, Show, Generic, Ord, Typeable)
597617
598618newtype NodeAttrName = NodeAttrName Text deriving (Eq, Read, Show, Ord, Generic, Typeable)
599619
@@ -1719,7 +1739,7 @@ data TermsAggregation = TermsAggregation { term :: Either Text Text
17191739 , termAggs :: Maybe Aggregations
17201740 } deriving (Eq, Read, Show, Generic, Typeable)
17211741
1722−data CardinalityAggregation = CardinalityAggregation { cardinalityField :: FieldName,
1742+data CardinalityAggregation = CardinalityAggregation { cardinalityField :: FieldName,
17231743 precisionThreshold :: Maybe Int
17241744 } deriving (Eq, Read, Show, Generic, Typeable)
17251745
@@ -3854,6 +3874,280 @@ data NodesInfo = NodesInfo {
38543874 , nodesClusterName :: ClusterName
38553875 } deriving (Eq, Show, Generic, Typeable)
38563876
3877+data NodesStats = NodesStats {
3878+ nodesStats :: [NodeStats]
3879+ , nodesStatsClusterName :: ClusterName
3880+ } deriving (Eq, Show, Generic, Typeable)
3881+
3882+data NodeStats = NodeStats {
3883+ nodeStatsName :: NodeName
3884+ , nodeStatsFullId :: FullNodeId
3885+ , nodeStatsBreakersStats :: Maybe NodeBreakersStats
3886+ , nodeStatsHTTP :: NodeHTTPStats
3887+ , nodeStatsTransport :: NodeTransportStats
3888+ , nodeStatsFS :: NodeFSStats
3889+ , nodeStatsNetwork :: NodeNetworkStats
3890+ , nodeStatsThreadPool :: NodeThreadPoolsStats
3891+ , nodeStatsJVM :: NodeJVMStats
3892+ , nodeStatsProcess :: NodeProcessStats
3893+ , nodeStatsOS :: NodeOSStats
3894+ , nodeStatsIndices :: NodeIndicesStats
3895+ } deriving (Eq, Show, Generic, Typeable)
3896+
3897+data NodeBreakersStats = NodeBreakersStats {
3898+ nodeStatsParentBreaker :: NodeBreakerStats
3899+ , nodeStatsRequestBreaker :: NodeBreakerStats
3900+ , nodeStatsFieldDataBreaker :: NodeBreakerStats
3901+ } deriving (Eq, Show, Generic, Typeable)
3902+
3903+data NodeBreakerStats = NodeBreakerStats {
3904+ nodeBreakersTripped :: Int
3905+ , nodeBreakersOverhead :: Double
3906+ , nodeBreakersEstSize :: Bytes
3907+ , nodeBreakersLimitSize :: Bytes
3908+ } deriving (Eq, Show, Generic, Typeable)
3909+
3910+data NodeHTTPStats = NodeHTTPStats {
3911+ nodeHTTPTotalOpened :: Int
3912+ , nodeHTTPCurrentOpen :: Int
3913+ } deriving (Eq, Show, Generic, Typeable)
3914+
3915+data NodeTransportStats = NodeTransportStats {
3916+ nodeTransportTXSize :: Bytes
3917+ , nodeTransportCount :: Int
3918+ , nodeTransportRXSize :: Bytes
3919+ , nodeTransportRXCount :: Int
3920+ , nodeTransportServerOpen :: Int
3921+ } deriving (Eq, Show, Generic, Typeable)
3922+
3923+data NodeFSStats = NodeFSStats {
3924+ nodeFSDataPaths :: [NodeDataPathStats]
3925+ , nodeFSTotal :: NodeFSTotalStats
3926+ , nodeFSTimestamp :: UTCTime
3927+ } deriving (Eq, Show, Generic, Typeable)
3928+
3929+data NodeDataPathStats = NodeDataPathStats {
3930+ nodeDataPathDiskServiceTime :: Maybe Double
3931+ , nodeDataPathDiskQueue :: Maybe Double
3932+ , nodeDataPathIOSize :: Maybe Bytes
3933+ , nodeDataPathWriteSize :: Maybe Bytes
3934+ , nodeDataPathReadSize :: Maybe Bytes
3935+ , nodeDataPathIOOps :: Maybe Int
3936+ , nodeDataPathWrites :: Maybe Int
3937+ , nodeDataPathReads :: Maybe Int
3938+ , nodeDataPathAvailable :: Bytes
3939+ , nodeDataPathFree :: Bytes
3940+ , nodeDataPathTotal :: Bytes
3941+ , nodeDataPathType :: Maybe Text
3942+ , nodeDataPathDevice :: Text
3943+ , nodeDataPathMount :: Text
3944+ , nodeDataPathPath :: Text
3945+ } deriving (Eq, Show, Generic, Typeable)
3946+
3947+data NodeFSTotalStats = NodeFSTotalStats {
3948+ nodeFSTotalDiskServiceTime :: Maybe Double
3949+ , nodeFSTotalDiskQueue :: Maybe Double
3950+ , nodeFSTotalIOSize :: Maybe Bytes
3951+ , nodeFSTotalWriteSize :: Maybe Bytes
3952+ , nodeFSTotalReadSize :: Maybe Bytes
3953+ , nodeFSTotalIOOps :: Maybe Int
3954+ , nodeFSTotalWrites :: Maybe Int
3955+ , nodeFSTotalReads :: Maybe Int
3956+ , nodeFSTotalAvailable :: Bytes
3957+ , nodeFSTotalFree :: Bytes
3958+ , nodeFSTotalTotal :: Bytes
3959+ } deriving (Eq, Show, Generic, Typeable)
3960+
3961+data NodeNetworkStats = NodeNetworkStats {
3962+ nodeNetTCPOutRSTs :: Int
3963+ , nodeNetTCPInErrs :: Int
3964+ , nodeNetTCPAttemptFails :: Int
3965+ , nodeNetTCPEstabResets :: Int
3966+ , nodeNetTCPRetransSegs :: Int
3967+ , nodeNetTCPOutSegs :: Int
3968+ , nodeNetTCPInSegs :: Int
3969+ , nodeNetTCPCurrEstab :: Int
3970+ , nodeNetTCPPassiveOpens :: Int
3971+ , nodeNetTCPActiveOpens :: Int
3972+ } deriving (Eq, Show, Generic, Typeable)
3973+
3974+data NodeThreadPoolsStats = NodeThreadPoolsStats {
3975+ nodeThreadPoolsStatsSnapshot :: NodeThreadPoolStats
3976+ , nodeThreadPoolsStatsBulk :: NodeThreadPoolStats
3977+ , nodeThreadPoolsStatsMerge :: NodeThreadPoolStats
3978+ , nodeThreadPoolsStatsGet :: NodeThreadPoolStats
3979+ , nodeThreadPoolsStatsManagement :: NodeThreadPoolStats
3980+ , nodeThreadPoolsStatsFetchShardStore :: Maybe NodeThreadPoolStats
3981+ , nodeThreadPoolsStatsOptimize :: NodeThreadPoolStats
3982+ , nodeThreadPoolsStatsFlush :: NodeThreadPoolStats
3983+ , nodeThreadPoolsStatsSearch :: NodeThreadPoolStats
3984+ , nodeThreadPoolsStatsWarmer :: NodeThreadPoolStats
3985+ , nodeThreadPoolsStatsGeneric :: NodeThreadPoolStats
3986+ , nodeThreadPoolsStatsSuggest :: NodeThreadPoolStats
3987+ , nodeThreadPoolsStatsRefresh :: NodeThreadPoolStats
3988+ , nodeThreadPoolsStatsIndex :: NodeThreadPoolStats
3989+ , nodeThreadPoolsStatsListener :: Maybe NodeThreadPoolStats
3990+ , nodeThreadPoolsStatsFetchShardStarted :: Maybe NodeThreadPoolStats
3991+ , nodeThreadPoolsStatsPercolate :: NodeThreadPoolStats
3992+ } deriving (Eq, Show, Generic, Typeable)
3993+
3994+data NodeThreadPoolStats = NodeThreadPoolStats {
3995+ nodeThreadPoolCompleted :: Int
3996+ , nodeThreadPoolLargest :: Int
3997+ , nodeThreadPoolRejected :: Int
3998+ , nodeThreadPoolActive :: Int
3999+ , nodeThreadPoolQueue :: Int
4000+ , nodeThreadPoolThreads :: Int
4001+ } deriving (Eq, Show, Generic, Typeable)
4002+
4003+data NodeJVMStats = NodeJVMStats {
4004+ nodeJVMStatsMappedBufferPool :: JVMBufferPoolStats
4005+ , nodeJVMStatsDirectBufferPool :: JVMBufferPoolStats
4006+ , nodeJVMStatsGCOldCollector :: JVMGCStats
4007+ , nodeJVMStatsGCYoungCollector :: JVMGCStats
4008+ , nodeJVMStatsPeakThreadsCount :: Int
4009+ , nodeJVMStatsThreadsCount :: Int
4010+ , nodeJVMStatsOldPool :: JVMPoolStats
4011+ , nodeJVMStatsSurvivorPool :: JVMPoolStats
4012+ , nodeJVMStatsYoungPool :: JVMPoolStats
4013+ , nodeJVMStatsNonHeapCommitted :: Bytes
4014+ , nodeJVMStatsNonHeapUsed :: Bytes
4015+ , nodeJVMStatsHeapMax :: Bytes
4016+ , nodeJVMStatsHeapCommitted :: Bytes
4017+ , nodeJVMStatsHeapUsedPercent :: Int
4018+ , nodeJVMStatsHeapUsed :: Bytes
4019+ , nodeJVMStatsUptime :: NominalDiffTime
4020+ , nodeJVMStatsTimestamp :: UTCTime
4021+ } deriving (Eq, Show, Generic, Typeable)
4022+
4023+data JVMBufferPoolStats = JVMBufferPoolStats {
4024+ jvmBufferPoolStatsTotalCapacity :: Bytes
4025+ , jvmBufferPoolStatsUsed :: Bytes
4026+ , jvmBufferPoolStatsCount :: Int
4027+ } deriving (Eq, Show, Generic, Typeable)
4028+
4029+data JVMGCStats = JVMGCStats {
4030+ jvmGCStatsCollectionTime :: NominalDiffTime
4031+ , jvmGCStatsCollectionCount :: Int
4032+ } deriving (Eq, Show, Generic, Typeable)
4033+
4034+data JVMPoolStats = JVMPoolStats {
4035+ jvmPoolStatsPeakMax :: Bytes
4036+ , jvmPoolStatsPeakUsed :: Bytes
4037+ , jvmPoolStatsMax :: Bytes
4038+ , jvmPoolStatsUsed :: Bytes
4039+ } deriving (Eq, Show, Generic, Typeable)
4040+
4041+data NodeProcessStats = NodeProcessStats {
4042+ nodeProcessMemTotalVirtual :: Bytes
4043+ , nodeProcessMemShare :: Bytes
4044+ , nodeProcessMemResident :: Bytes
4045+ , nodeProcessCPUTotal :: NominalDiffTime
4046+ , nodeProcessCPUUser :: NominalDiffTime
4047+ , nodeProcessCPUSys :: NominalDiffTime
4048+ , nodeProcessCPUPercent :: Int
4049+ , nodeProcessOpenFDs :: Int
4050+ , nodeProcessTimestamp :: UTCTime
4051+ } deriving (Eq, Show, Generic, Typeable)
4052+
4053+data NodeOSStats = NodeOSStats {
4054+ nodeOSSwapFree :: Bytes
4055+ , nodeOSSwapUsed :: Bytes
4056+ , nodeOSMemActualUsed :: Bytes
4057+ , nodeOSMemActualFree :: Bytes
4058+ , nodeOSMemUsedPercent :: Int
4059+ , nodeOSMemFreePercent :: Int
4060+ , nodeOSMemUsed :: Bytes
4061+ , nodeOSMemFree :: Bytes
4062+ , nodeOSCPUStolen :: Int
4063+ , nodeOSCPUUsage :: Int
4064+ , nodeOSCPUIdle :: Int
4065+ , nodeOSCPUUser :: Int
4066+ , nodeOSCPUSys :: Int
4067+ , nodeOSLoad :: LoadAvgs
4068+ , nodeOSUptime :: NominalDiffTime
4069+ , nodeOSTimestamp :: UTCTime
4070+ } deriving (Eq, Show, Generic, Typeable)
4071+
4072+data LoadAvgs = LoadAvgs {
4073+ loadAvg1Min :: Double
4074+ , loadAvg5Min :: Double
4075+ , loadAvg15Min :: Double
4076+ } deriving (Eq, Show, Generic, Typeable)
4077+
4078+data NodeIndicesStats = NodeIndicesStats {
4079+ nodeIndicesStatsRecoveryThrottleTime :: Maybe NominalDiffTime
4080+ , nodeIndicesStatsRecoveryCurrentAsTarget :: Maybe Int
4081+ , nodeIndicesStatsRecoveryCurrentAsSource :: Maybe Int
4082+ , nodeIndicesStatsQueryCacheMisses :: Maybe Int
4083+ , nodeIndicesStatsQueryCacheHits :: Maybe Int
4084+ , nodeIndicesStatsQueryCacheEvictions :: Maybe Int
4085+ , nodeIndicesStatsQueryCacheSize :: Maybe Bytes
4086+ , nodeIndicesStatsSuggestCurrent :: Int
4087+ , nodeIndicesStatsSuggestTime :: NominalDiffTime
4088+ , nodeIndicesStatsSuggestTotal :: Int
4089+ , nodeIndicesStatsTranslogSize :: Bytes
4090+ , nodeIndicesStatsTranslogOps :: Int
4091+ , nodeIndicesStatsSegFixedBitSetMemory :: Maybe Bytes
4092+ , nodeIndicesStatsSegVersionMapMemory :: Bytes
4093+ , nodeIndicesStatsSegIndexWriterMaxMemory :: Maybe Bytes
4094+ , nodeIndicesStatsSegIndexWriterMemory :: Bytes
4095+ , nodeIndicesStatsSegMemory :: Bytes
4096+ , nodeIndicesStatsSegCount :: Int
4097+ , nodeIndicesStatsCompletionSize :: Bytes
4098+ , nodeIndicesStatsPercolateQueries :: Int
4099+ , nodeIndicesStatsPercolateMemory :: Bytes
4100+ , nodeIndicesStatsPercolateCurrent :: Int
4101+ , nodeIndicesStatsPercolateTime :: NominalDiffTime
4102+ , nodeIndicesStatsPercolateTotal :: Int
4103+ , nodeIndicesStatsFieldDataEvictions :: Int
4104+ , nodeIndicesStatsFieldDataMemory :: Bytes
4105+ , nodeIndicesStatsIDCacheMemory :: Bytes
4106+ , nodeIndicesStatsFilterCacheEvictions :: Int
4107+ , nodeIndicesStatsFilterCacheMemory :: Bytes
4108+ , nodeIndicesStatsWarmerTotalTime :: NominalDiffTime
4109+ , nodeIndicesStatsWarmerTotal :: Int
4110+ , nodeIndicesStatsWarmerCurrent :: Int
4111+ , nodeIndicesStatsFlushTotalTime :: NominalDiffTime
4112+ , nodeIndicesStatsFlushTotal :: Int
4113+ , nodeIndicesStatsRefreshTotalTime :: NominalDiffTime
4114+ , nodeIndicesStatsRefreshTotal :: Int
4115+ , nodeIndicesStatsMergesTotalSize :: Bytes
4116+ , nodeIndicesStatsMergesTotalDocs :: Int
4117+ , nodeIndicesStatsMergesTotalTime :: NominalDiffTime
4118+ , nodeIndicesStatsMergesTotal :: Int
4119+ , nodeIndicesStatsMergesCurrentSize :: Bytes
4120+ , nodeIndicesStatsMergesCurrentDocs :: Int
4121+ , nodeIndicesStatsMergesCurrent :: Int
4122+ , nodeIndicesStatsSearchFetchCurrent :: Int
4123+ , nodeIndicesStatsSearchFetchTime :: NominalDiffTime
4124+ , nodeIndicesStatsSearchFetchTotal :: Int
4125+ , nodeIndicesStatsSearchQueryCurrent :: Int
4126+ , nodeIndicesStatsSearchQueryTime :: NominalDiffTime
4127+ , nodeIndicesStatsSearchQueryTotal :: Int
4128+ , nodeIndicesStatsSearchOpenContexts :: Int
4129+ , nodeIndicesStatsGetCurrent :: Int
4130+ , nodeIndicesStatsGetMissingTime :: NominalDiffTime
4131+ , nodeIndicesStatsGetMissingTotal :: Int
4132+ , nodeIndicesStatsGetExistsTime :: NominalDiffTime
4133+ , nodeIndicesStatsGetExistsTotal :: Int
4134+ , nodeIndicesStatsGetTime :: NominalDiffTime
4135+ , nodeIndicesStatsGetTotal :: Int
4136+ , nodeIndicesStatsIndexingThrottleTime :: Maybe NominalDiffTime
4137+ , nodeIndicesStatsIndexingIsThrottled :: Maybe Bool
4138+ , nodeIndicesStatsIndexingNoopUpdateTotal :: Maybe Int
4139+ , nodeIndicesStatsIndexingDeleteCurrent :: Int
4140+ , nodeIndicesStatsIndexingDeleteTime :: NominalDiffTime
4141+ , nodeIndicesStatsIndexingDeleteTotal :: Int
4142+ , nodeIndicesStatsIndexingIndexCurrent :: Int
4143+ , nodeIndicesStatsIndexingIndexTime :: NominalDiffTime
4144+ , nodeIndicesStatsIndexingTotal :: Int
4145+ , nodeIndicesStatsStoreThrottleTime :: NominalDiffTime
4146+ , nodeIndicesStatsStoreSize :: Bytes
4147+ , nodeIndicesStatsDocsDeleted :: Int
4148+ , nodeIndicesStatsDocsCount :: Int
4149+ } deriving (Eq, Show, Generic, Typeable)
4150+
38574151-- | A quirky address format used throughout ElasticSearch. An example
38584152-- would be inet[/1.1.1.1:9200]. inet may be a placeholder for a
38594153-- <https://en.wikipedia.org/wiki/Fully_qualified_domain_name FQDN>.
@@ -4373,6 +4667,359 @@ instance FromJSON NodesInfo where
43734667 cn <- o .: "cluster_name"
43744668 return (NodesInfo infos cn)
43754669
4670+instance FromJSON NodesStats where
4671+ parseJSON = withObject "NodesStats" parse
4672+ where
4673+ parse o = do
4674+ nodes <- o .: "nodes"
4675+ stats <- forM (HM.toList nodes) $ \(fullNID, v) -> do
4676+ node <- parseJSON v
4677+ parseNodeStats (FullNodeId fullNID) node
4678+ cn <- o .: "cluster_name"
4679+ return (NodesStats stats cn)
4680+
4681+instance FromJSON NodeBreakerStats where
4682+ parseJSON = withObject "NodeBreakerStats" parse
4683+ where
4684+ parse o = NodeBreakerStats <$> o .: "tripped"
4685+ <*> o .: "overhead"
4686+ <*> o .: "estimated_size_in_bytes"
4687+ <*> o .: "limit_size_in_bytes"
4688+
4689+instance FromJSON NodeHTTPStats where
4690+ parseJSON = withObject "NodeHTTPStats" parse
4691+ where
4692+ parse o = NodeHTTPStats <$> o .: "total_opened"
4693+ <*> o .: "current_open"
4694+
4695+instance FromJSON NodeTransportStats where
4696+ parseJSON = withObject "NodeTransportStats" parse
4697+ where
4698+ parse o = NodeTransportStats <$> o .: "tx_size_in_bytes"
4699+ <*> o .: "tx_count"
4700+ <*> o .: "rx_size_in_bytes"
4701+ <*> o .: "rx_count"
4702+ <*> o .: "server_open"
4703+
4704+instance FromJSON NodeFSStats where
4705+ parseJSON = withObject "NodeFSStats" parse
4706+ where
4707+ parse o = NodeFSStats <$> o .: "data"
4708+ <*> o .: "total"
4709+ <*> (posixMS <$> o .: "timestamp")
4710+
4711+instance FromJSON NodeDataPathStats where
4712+ parseJSON = withObject "NodeDataPathStats" parse
4713+ where
4714+ parse o =
4715+ NodeDataPathStats <$> (fmap unStringlyTypedDouble <$> o .:? "disk_service_time")
4716+ <*> (fmap unStringlyTypedDouble <$> o .:? "disk_queue")
4717+ <*> o .:? "disk_io_size_in_bytes"
4718+ <*> o .:? "disk_write_size_in_bytes"
4719+ <*> o .:? "disk_read_size_in_bytes"
4720+ <*> o .:? "disk_io_op"
4721+ <*> o .:? "disk_writes"
4722+ <*> o .:? "disk_reads"
4723+ <*> o .: "available_in_bytes"
4724+ <*> o .: "free_in_bytes"
4725+ <*> o .: "total_in_bytes"
4726+ <*> o .:? "type"
4727+ <*> o .: "dev"
4728+ <*> o .: "mount"
4729+ <*> o .: "path"
4730+
4731+newtype StringlyTypedDouble = StringlyTypedDouble { unStringlyTypedDouble :: Double }
4732+
4733+
4734+instance FromJSON StringlyTypedDouble where
4735+ parseJSON = fmap StringlyTypedDouble . parseJSON . unStringlyTypeJSON
4736+
4737+
4738+instance FromJSON NodeFSTotalStats where
4739+ parseJSON = withObject "NodeFSTotalStats" parse
4740+ where
4741+ parse o = NodeFSTotalStats <$> (fmap unStringlyTypedDouble <$> o .:? "disk_service_time")
4742+ <*> (fmap unStringlyTypedDouble <$> o .:? "disk_queue")
4743+ <*> o .:? "disk_io_size_in_bytes"
4744+ <*> o .:? "disk_write_size_in_bytes"
4745+ <*> o .:? "disk_read_size_in_bytes"
4746+ <*> o .:? "disk_io_op"
4747+ <*> o .:? "disk_writes"
4748+ <*> o .:? "disk_reads"
4749+ <*> o .: "available_in_bytes"
4750+ <*> o .: "free_in_bytes"
4751+ <*> o .: "total_in_bytes"
4752+
4753+instance FromJSON NodeNetworkStats where
4754+ parseJSON = withObject "NodeNetworkStats" parse
4755+ where
4756+ parse o = do
4757+ tcp <- o .: "tcp"
4758+ NodeNetworkStats <$> tcp .: "out_rsts"
4759+ <*> tcp .: "in_errs"
4760+ <*> tcp .: "attempt_fails"
4761+ <*> tcp .: "estab_resets"
4762+ <*> tcp .: "retrans_segs"
4763+ <*> tcp .: "out_segs"
4764+ <*> tcp .: "in_segs"
4765+ <*> tcp .: "curr_estab"
4766+ <*> tcp .: "passive_opens"
4767+ <*> tcp .: "active_opens"
4768+
4769+instance FromJSON NodeThreadPoolsStats where
4770+ parseJSON = withObject "NodeThreadPoolsStats" parse
4771+ where
4772+ parse o = NodeThreadPoolsStats <$> o .: "snapshot"
4773+ <*> o .: "bulk"
4774+ <*> o .: "merge"
4775+ <*> o .: "get"
4776+ <*> o .: "management"
4777+ <*> o .:? "fetch_shard_store"
4778+ <*> o .: "optimize"
4779+ <*> o .: "flush"
4780+ <*> o .: "search"
4781+ <*> o .: "warmer"
4782+ <*> o .: "generic"
4783+ <*> o .: "suggest"
4784+ <*> o .: "refresh"
4785+ <*> o .: "index"
4786+ <*> o .:? "listener"
4787+ <*> o .:? "fetch_shard_started"
4788+ <*> o .: "percolate"
4789+instance FromJSON NodeThreadPoolStats where
4790+ parseJSON = withObject "NodeThreadPoolStats" parse
4791+ where
4792+ parse o = NodeThreadPoolStats <$> o .: "completed"
4793+ <*> o .: "largest"
4794+ <*> o .: "rejected"
4795+ <*> o .: "active"
4796+ <*> o .: "queue"
4797+ <*> o .: "threads"
4798+
4799+instance FromJSON NodeJVMStats where
4800+ parseJSON = withObject "NodeJVMStats" parse
4801+ where
4802+ parse o = do
4803+ bufferPools <- o .: "buffer_pools"
4804+ mapped <- bufferPools .: "mapped"
4805+ direct <- bufferPools .: "direct"
4806+ gc <- o .: "gc"
4807+ collectors <- gc .: "collectors"
4808+ oldC <- collectors .: "old"
4809+ youngC <- collectors .: "young"
4810+ threads <- o .: "threads"
4811+ mem <- o .: "mem"
4812+ pools <- mem .: "pools"
4813+ oldM <- pools .: "old"
4814+ survivorM <- pools .: "survivor"
4815+ youngM <- pools .: "young"
4816+ NodeJVMStats <$> pure mapped
4817+ <*> pure direct
4818+ <*> pure oldC
4819+ <*> pure youngC
4820+ <*> threads .: "peak_count"
4821+ <*> threads .: "count"
4822+ <*> pure oldM
4823+ <*> pure survivorM
4824+ <*> pure youngM
4825+ <*> mem .: "non_heap_committed_in_bytes"
4826+ <*> mem .: "non_heap_used_in_bytes"
4827+ <*> mem .: "heap_max_in_bytes"
4828+ <*> mem .: "heap_committed_in_bytes"
4829+ <*> mem .: "heap_used_percent"
4830+ <*> mem .: "heap_used_in_bytes"
4831+ <*> (unMS <$> o .: "uptime_in_millis")
4832+ <*> (posixMS <$> o .: "timestamp")
4833+
4834+instance FromJSON JVMBufferPoolStats where
4835+ parseJSON = withObject "JVMBufferPoolStats" parse
4836+ where
4837+ parse o = JVMBufferPoolStats <$> o .: "total_capacity_in_bytes"
4838+ <*> o .: "used_in_bytes"
4839+ <*> o .: "count"
4840+
4841+instance FromJSON JVMGCStats where
4842+ parseJSON = withObject "JVMGCStats" parse
4843+ where
4844+ parse o = JVMGCStats <$> (unMS <$> o .: "collection_time_in_millis")
4845+ <*> o .: "collection_count"
4846+
4847+instance FromJSON JVMPoolStats where
4848+ parseJSON = withObject "JVMPoolStats" parse
4849+ where
4850+ parse o = JVMPoolStats <$> o .: "peak_max_in_bytes"
4851+ <*> o .: "peak_used_in_bytes"
4852+ <*> o .: "max_in_bytes"
4853+ <*> o .: "used_in_bytes"
4854+
4855+instance FromJSON NodeProcessStats where
4856+ parseJSON = withObject "NodeProcessStats" parse
4857+ where
4858+ parse o = do
4859+ mem <- o .: "mem"
4860+ cpu <- o .: "cpu"
4861+ NodeProcessStats <$> mem .: "total_virtual_in_bytes"
4862+ <*> mem .: "share_in_bytes"
4863+ <*> mem .: "resident_in_bytes"
4864+ <*> (unMS <$> cpu .: "total_in_millis")
4865+ <*> (unMS <$> cpu .: "user_in_millis")
4866+ <*> (unMS <$> cpu .: "sys_in_millis")
4867+ <*> cpu .: "percent"
4868+ <*> o .: "open_file_descriptors"
4869+ <*> (posixMS <$> o .: "timestamp")
4870+
4871+instance FromJSON NodeOSStats where
4872+ parseJSON = withObject "NodeOSStats" parse
4873+ where
4874+ parse o = do
4875+ swap <- o .: "swap"
4876+ mem <- o .: "mem"
4877+ cpu <- o .: "cpu"
4878+ load <- o .: "load_average"
4879+ NodeOSStats <$> swap .: "free_in_bytes"
4880+ <*> swap .: "used_in_bytes"
4881+ <*> mem .: "actual_used_in_bytes"
4882+ <*> mem .: "actual_free_in_bytes"
4883+ <*> mem .: "used_percent"
4884+ <*> mem .: "free_percent"
4885+ <*> mem .: "used_in_bytes"
4886+ <*> mem .: "free_in_bytes"
4887+ <*> cpu .: "stolen"
4888+ <*> cpu .: "usage"
4889+ <*> cpu .: "idle"
4890+ <*> cpu .: "user"
4891+ <*> cpu .: "sys"
4892+ <*> pure load
4893+ <*> (unMS <$> o .: "uptime_in_millis")
4894+ <*> (posixMS <$> o .: "timestamp")
4895+
4896+instance FromJSON LoadAvgs where
4897+ parseJSON = withArray "LoadAvgs" parse
4898+ where
4899+ parse v = case V.toList v of
4900+ [one, five, fifteen] -> LoadAvgs <$> parseJSON one
4901+ <*> parseJSON five
4902+ <*> parseJSON fifteen
4903+ _ -> fail "Expecting a triple of Doubles"
4904+
4905+instance FromJSON NodeIndicesStats where
4906+ parseJSON = withObject "NodeIndicesStats" parse
4907+ where
4908+ parse o = do
4909+ let (.::) mv k = case mv of
4910+ Just v -> Just <$> v .: k
4911+ Nothing -> pure Nothing
4912+ mRecovery <- o .:? "recovery"
4913+ mQueryCache <- o .:? "query_cache"
4914+ suggest <- o .: "suggest"
4915+ translog <- o .: "translog"
4916+ segments <- o .: "segments"
4917+ completion <- o .: "completion"
4918+ percolate <- o .: "percolate"
4919+ fielddata <- o .: "fielddata"
4920+ idCache <- o .: "id_cache"
4921+ filterCache <- o .: "filter_cache"
4922+ warmer <- o .: "warmer"
4923+ flush <- o .: "flush"
4924+ refresh <- o .: "refresh"
4925+ merges <- o .: "merges"
4926+ search <- o .: "search"
4927+ getStats <- o .: "get"
4928+ indexing <- o .: "indexing"
4929+ store <- o .: "store"
4930+ docs <- o .: "docs"
4931+ NodeIndicesStats <$> (fmap unMS <$> mRecovery .:: "throttle_time_in_millis")
4932+ <*> mRecovery .:: "current_as_target"
4933+ <*> mRecovery .:: "current_as_source"
4934+ <*> mQueryCache .:: "miss_count"
4935+ <*> mQueryCache .:: "hit_count"
4936+ <*> mQueryCache .:: "evictions"
4937+ <*> mQueryCache .:: "memory_size_in_bytes"
4938+ <*> suggest .: "current"
4939+ <*> (unMS <$> suggest .: "time_in_millis")
4940+ <*> suggest .: "total"
4941+ <*> translog .: "size_in_bytes"
4942+ <*> translog .: "operations"
4943+ <*> segments .:? "fixed_bit_set_memory_in_bytes"
4944+ <*> segments .: "version_map_memory_in_bytes"
4945+ <*> segments .:? "index_writer_max_memory_in_bytes"
4946+ <*> segments .: "index_writer_memory_in_bytes"
4947+ <*> segments .: "memory_in_bytes"
4948+ <*> segments .: "count"
4949+ <*> completion .: "size_in_bytes"
4950+ <*> percolate .: "queries"
4951+ <*> percolate .: "memory_size_in_bytes"
4952+ <*> percolate .: "current"
4953+ <*> (unMS <$> percolate .: "time_in_millis")
4954+ <*> percolate .: "total"
4955+ <*> fielddata .: "evictions"
4956+ <*> fielddata .: "memory_size_in_bytes"
4957+ <*> idCache .: "memory_size_in_bytes"
4958+ <*> filterCache .: "evictions"
4959+ <*> filterCache .: "memory_size_in_bytes"
4960+ <*> (unMS <$> warmer .: "total_time_in_millis")
4961+ <*> warmer .: "total"
4962+ <*> warmer .: "current"
4963+ <*> (unMS <$> flush .: "total_time_in_millis")
4964+ <*> flush .: "total"
4965+ <*> (unMS <$> refresh .: "total_time_in_millis")
4966+ <*> refresh .: "total"
4967+ <*> merges .: "total_size_in_bytes"
4968+ <*> merges .: "total_docs"
4969+ <*> (unMS <$> merges .: "total_time_in_millis")
4970+ <*> merges .: "total"
4971+ <*> merges .: "current_size_in_bytes"
4972+ <*> merges .: "current_docs"
4973+ <*> merges .: "current"
4974+ <*> search .: "fetch_current"
4975+ <*> (unMS <$> search .: "fetch_time_in_millis")
4976+ <*> search .: "fetch_total"
4977+ <*> search .: "query_current"
4978+ <*> (unMS <$> search .: "query_time_in_millis")
4979+ <*> search .: "query_total"
4980+ <*> search .: "open_contexts"
4981+ <*> getStats .: "current"
4982+ <*> (unMS <$> getStats .: "missing_time_in_millis")
4983+ <*> getStats .: "missing_total"
4984+ <*> (unMS <$> getStats .: "exists_time_in_millis")
4985+ <*> getStats .: "exists_total"
4986+ <*> (unMS <$> getStats .: "time_in_millis")
4987+ <*> getStats .: "total"
4988+ <*> (fmap unMS <$> indexing .:? "throttle_time_in_millis")
4989+ <*> indexing .:? "is_throttled"
4990+ <*> indexing .:? "noop_update_total"
4991+ <*> indexing .: "delete_current"
4992+ <*> (unMS <$> indexing .: "delete_time_in_millis")
4993+ <*> indexing .: "delete_total"
4994+ <*> indexing .: "index_current"
4995+ <*> (unMS <$> indexing .: "index_time_in_millis")
4996+ <*> indexing .: "index_total"
4997+ <*> (unMS <$> store .: "throttle_time_in_millis")
4998+ <*> store .: "size_in_bytes"
4999+ <*> docs .: "deleted"
5000+ <*> docs .: "count"
5001+
5002+instance FromJSON NodeBreakersStats where
5003+ parseJSON = withObject "NodeBreakersStats" parse
5004+ where
5005+ parse o = NodeBreakersStats <$> o .: "parent"
5006+ <*> o .: "request"
5007+ <*> o .: "fielddata"
5008+
5009+parseNodeStats :: FullNodeId -> Object -> Parser NodeStats
5010+parseNodeStats fnid o = do
5011+ NodeStats <$> o .: "name"
5012+ <*> pure fnid
5013+ <*> o .:? "breakers"
5014+ <*> o .: "http"
5015+ <*> o .: "transport"
5016+ <*> o .: "fs"
5017+ <*> o .: "network"
5018+ <*> o .: "thread_pool"
5019+ <*> o .: "jvm"
5020+ <*> o .: "process"
5021+ <*> o .: "os"
5022+ <*> o .: "indices"
43765023
43775024parseNodeInfo :: FullNodeId -> Object -> Parser NodeInfo
43785025parseNodeInfo nid o =