git.iko.soy/typeable/bloodhound
on master help sign in
WIP: more types added
commit433e3bbebc26a44d17c3811fbbe140820db08a64 authorMichael Xavier <michael@michaelxavier.net> dateWed 31 Aug 2016, 19:55 (10 years ago) parent976143c
1 file changed+220−34
src/Database/Bloodhound/Types.hs+220−34
src/Database/Bloodhound/Types.hs+220−34
@@ -260,12 +260,16 @@ module Database.Bloodhound.Types
260260 , NodesInfo(..)
261261 , NodesStats(..)
262262 , NodeStats(..)
263+ , NodeBreakersStats(..)
263264 , NodeBreakerStats(..)
264265 , NodeHTTPStats(..)
265266 , NodeTransportStats(..)
266267 , NodeFSStats(..)
268+ , NodeDataPathStats(..)
269+ , NodeFSTotalStats(..)
267270 , NodeNetworkStats(..)
268271 , NodeThreadPoolsStats(..)
272+ , NodeThreadPoolStats(..)
269273 , NodeJVMStats(..)
270274 , NodeProcessStats(..)
271275 , NodeOSStats(..)
@@ -3859,39 +3863,125 @@ data NodesStats = NodesStats {
38593863 } deriving (Eq, Show, Generic, Typeable)
38603864
38613865data NodeStats = NodeStats {
3862− nodeStatsName :: NodeName
3863− , nodeStatsFullId :: FullNodeId
3864− , nodeStatsParentBreaker :: NodeBreakerStats
3866+ nodeStatsName :: NodeName
3867+ , nodeStatsFullId :: FullNodeId
3868+ , nodeStatsBreakersStats :: NodeBreakersStats
3869+ , nodeStatsHTTP :: NodeHTTPStats
3870+ , nodeStatsTransport :: NodeTransportStats
3871+ , nodeStatsFS :: NodeFSStats
3872+ , nodeStatsNetwork :: NodeNetworkStats
3873+ , nodeStatsThreadPool :: NodeThreadPoolsStats
3874+ , nodeStatsJVM :: NodeJVMStats
3875+ , nodeStatsProcess :: NodeProcessStats
3876+ , nodeStatsOS :: NodeOSStats
3877+ , nodeStatsIndices :: NodeIndicesStats
3878+ } deriving (Eq, Show, Generic, Typeable)
3879+
3880+data NodeBreakersStats = NodeBreakersStats {
3881+ nodeStatsParentBreaker :: NodeBreakerStats
38653882 , nodeStatsRequestBreaker :: NodeBreakerStats
38663883 , 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
38763884 } deriving (Eq, Show, Generic, Typeable)
38773885
3878−data NodeBreakerStats = NodeBreakerStats
3879− deriving (Eq, Show, Generic, Typeable)
3886+data NodeBreakerStats = NodeBreakerStats {
3887+ nodeBreakersTripped :: Int
3888+ , nodeBreakersOverhead :: Double
3889+ , nodeBreakersEstSize :: Bytes
3890+ , nodeBreakersLimitSize :: Bytes
3891+ } deriving (Eq, Show, Generic, Typeable)
38803892
3881−data NodeHTTPStats = NodeHTTPStats
3882− deriving (Eq, Show, Generic, Typeable)
3893+data NodeHTTPStats = NodeHTTPStats {
3894+ nodeHTTPTotalOpened :: Int
3895+ , nodeHTTPCurrentOpen :: Int
3896+ } deriving (Eq, Show, Generic, Typeable)
38833897
3884−data NodeTransportStats = NodeTransportStats
3885− deriving (Eq, Show, Generic, Typeable)
3898+data NodeTransportStats = NodeTransportStats {
3899+ nodeTransportTXSize :: Bytes
3900+ , nodeTransportCount :: Int
3901+ , nodeTransportRXSize :: Bytes
3902+ , nodeTransportRXCount :: Int
3903+ , nodeTransportServerOpen :: Int
3904+ } deriving (Eq, Show, Generic, Typeable)
38863905
3887−data NodeFSStats = NodeFSStats
3888− deriving (Eq, Show, Generic, Typeable)
3906+data NodeFSStats = NodeFSStats {
3907+ nodeFSDataPaths :: [NodeDataPathStats]
3908+ , nodeFSTotal :: NodeFSTotalStats
3909+ , nodeFSTimestamp :: UTCTime
3910+ } deriving (Eq, Show, Generic, Typeable)
38893911
3890−data NodeNetworkStats = NodeNetworkStats
3891− deriving (Eq, Show, Generic, Typeable)
3912+data NodeDataPathStats = NodeDataPathStats {
3913+ nodeDataPathDiskServiceTime :: Double
3914+ , nodeDataPathDiskQueue :: Double
3915+ , nodeDataPathIOSize :: Bytes
3916+ , nodeDataPathWriteSize :: Bytes
3917+ , nodeDataPathReadSize :: Bytes
3918+ , nodeDataPathIOOps :: Int
3919+ , nodeDataPathWrites :: Int
3920+ , nodeDataPathReads :: Int
3921+ , nodeDataPathAvailable :: Bytes
3922+ , nodeDataPathFree :: Bytes
3923+ , nodeDataPathTotal :: Bytes
3924+ , nodeDataPathType :: Text
3925+ , nodeDataPathDevice :: Text
3926+ , nodeDataPathMount :: Text
3927+ , nodeDataPathPath :: Text
3928+ } deriving (Eq, Show, Generic, Typeable)
3929+
3930+data NodeFSTotalStats = NodeFSTotalStats {
3931+ nodeFSTotalDiskServiceTime :: Double
3932+ , nodeFSTotalDiskQueue :: Double
3933+ , nodeFSTotalIOSize :: Bytes
3934+ , nodeFSTotalWriteSize :: Bytes
3935+ , nodeFSTotalReadSize :: Bytes
3936+ , nodeFSTotalIOOps :: Int
3937+ , nodeFSTotalWrites :: Int
3938+ , nodeFSTotalReads :: Int
3939+ , nodeFSTotalAvailable :: Bytes
3940+ , nodeFSTotalFree :: Bytes
3941+ , nodeFSTotalTotal :: Bytes
3942+ } deriving (Eq, Show, Generic, Typeable)
38923943
3893−data NodeThreadPoolsStats = NodeThreadPoolsStats
3894− deriving (Eq, Show, Generic, Typeable)
3944+data NodeNetworkStats = NodeNetworkStats {
3945+ nodeNetTCPOutRSTs :: Int
3946+ , nodeNetTCPInErrs :: Int
3947+ , nodeNetTCPAttemptFails :: Int
3948+ , nodeNetTCPEstabResets :: Int
3949+ , nodeNetTCPRetransSegs :: Int
3950+ , nodeNetTCPOutSegs :: Int
3951+ , nodeNetTCPInSegs :: Int
3952+ , nodeNetTCPCurrEstab :: Int
3953+ , nodeNetTCPPassiveOpens :: Int
3954+ , nodeNetTCPActiveOpens :: Int
3955+ } deriving (Eq, Show, Generic, Typeable)
3956+
3957+data NodeThreadPoolsStats = NodeThreadPoolsStats {
3958+ nodeThreadPoolsStatsSnapshot :: NodeThreadPoolStats
3959+ , nodeThreadPoolsStatsBulk :: NodeThreadPoolStats
3960+ , nodeThreadPoolsStatsMerge :: NodeThreadPoolStats
3961+ , nodeThreadPoolsStatsGet :: NodeThreadPoolStats
3962+ , nodeThreadPoolsStatsManagement :: NodeThreadPoolStats
3963+ , nodeThreadPoolsStatsFetchShardStore :: NodeThreadPoolStats
3964+ , nodeThreadPoolsStatsOptimize :: NodeThreadPoolStats
3965+ , nodeThreadPoolsStatsFlush :: NodeThreadPoolStats
3966+ , nodeThreadPoolsStatsSearch :: NodeThreadPoolStats
3967+ , nodeThreadPoolsStatsWarmer :: NodeThreadPoolStats
3968+ , nodeThreadPoolsStatsGeneric :: NodeThreadPoolStats
3969+ , nodeThreadPoolsStatsSuggest :: NodeThreadPoolStats
3970+ , nodeThreadPoolsStatsRefresh :: NodeThreadPoolStats
3971+ , nodeThreadPoolsStatsIndex :: NodeThreadPoolStats
3972+ , nodeThreadPoolsStatsListener :: NodeThreadPoolStats
3973+ , nodeThreadPoolsStatsFetchShardStarted :: NodeThreadPoolStats
3974+ , nodeThreadPoolsStatsPercolate :: NodeThreadPoolStats
3975+ } deriving (Eq, Show, Generic, Typeable)
3976+
3977+data NodeThreadPoolStats = NodeThreadPoolStats {
3978+ nodeThreadPoolCompleted :: Int
3979+ , nodeThreadPoolLargest :: Int
3980+ , nodeThreadPoolRejected :: Int
3981+ , nodeThreadPoolActive :: Int
3982+ , nodeThreadPoolQueue :: Int
3983+ , nodeThreadPoolThreads :: Int
3984+ } deriving (Eq, Show, Generic, Typeable)
38953985
38963986data NodeJVMStats = NodeJVMStats
38973987 deriving (Eq, Show, Generic, Typeable)
@@ -4436,22 +4526,114 @@ instance FromJSON NodesStats where
44364526 return (NodesStats stats cn)
44374527
44384528instance FromJSON NodeBreakerStats where
4439− parseJSON _ = pure NodeBreakerStats
4529+ parseJSON = withObject "NodeBreakerStats" parse
4530+ where
4531+ parse o = NodeBreakerStats <$> o .: "tripped"
4532+ <*> o .: "overhead"
4533+ <*> o .: "estimated_size_in_bytes"
4534+ <*> o .: "limit_size_in_bytes"
44404535
44414536instance FromJSON NodeHTTPStats where
4442− parseJSON _ = pure NodeHTTPStats
4537+ parseJSON = withObject "NodeHTTPStats" parse
4538+ where
4539+ parse o = NodeHTTPStats <$> o .: "total_opened"
4540+ <*> o .: "current_open"
44434541
44444542instance FromJSON NodeTransportStats where
4445− parseJSON _ = pure NodeTransportStats
4543+ parseJSON = withObject "NodeTransportStats" parse
4544+ where
4545+ parse o = NodeTransportStats <$> o .: "tx_size_in_bytes"
4546+ <*> o .: "tx_count"
4547+ <*> o .: "rx_size_in_bytes"
4548+ <*> o .: "rx_count"
4549+ <*> o .: "server_open"
44464550
44474551instance FromJSON NodeFSStats where
4448− parseJSON _ = pure NodeFSStats
4552+ parseJSON = withObject "NodeFSStats" parse
4553+ where
4554+ parse o = NodeFSStats <$> o .: "data"
4555+ <*> o .: "total"
4556+ <*> (posixMS <$> o .: "timestamp")
4557+
4558+instance FromJSON NodeDataPathStats where
4559+ parseJSON = withObject "NodeDataPathStats" parse
4560+ where
4561+ parse o = NodeDataPathStats <$> (parseJSON . unStringlyTypeJSON =<< o .: "disk_service_time")
4562+ <*> (parseJSON . unStringlyTypeJSON =<< o .: "disk_queue")
4563+ <*> o .: "disk_io_size_in_bytes"
4564+ <*> o .: "disk_write_size_in_bytes"
4565+ <*> o .: "disk_read_size_in_bytes"
4566+ <*> o .: "disk_io_op"
4567+ <*> o .: "disk_writes"
4568+ <*> o .: "disk_reads"
4569+ <*> o .: "available_in_bytes"
4570+ <*> o .: "free_in_bytes"
4571+ <*> o .: "total_in_bytes"
4572+ <*> o .: "type"
4573+ <*> o .: "dev"
4574+ <*> o .: "mount"
4575+ <*> o .: "path"
4576+
4577+instance FromJSON NodeFSTotalStats where
4578+ parseJSON = withObject "NodeFSTotalStats" parse
4579+ where
4580+ parse o = NodeFSTotalStats <$> (parseJSON . unStringlyTypeJSON =<< o .: "disk_service_time")
4581+ <*> (parseJSON . unStringlyTypeJSON =<< o .: "disk_queue")
4582+ <*> o .: "disk_io_size_in_bytes"
4583+ <*> o .: "disk_write_size_in_bytes"
4584+ <*> o .: "disk_read_size_in_bytes"
4585+ <*> o .: "disk_io_op"
4586+ <*> o .: "disk_writes"
4587+ <*> o .: "disk_reads"
4588+ <*> o .: "available_in_bytes"
4589+ <*> o .: "free_in_bytes"
4590+ <*> o .: "total_in_bytes"
44494591
44504592instance FromJSON NodeNetworkStats where
4451− parseJSON _ = pure NodeNetworkStats
4593+ parseJSON = withObject "NodeNetworkStats" parse
4594+ where
4595+ parse o = do
4596+ tcp <- o .: "tcp"
4597+ NodeNetworkStats <$> tcp .: "out_rsts"
4598+ <*> tcp .: "in_errs"
4599+ <*> tcp .: "attempt_fails"
4600+ <*> tcp .: "estab_resets"
4601+ <*> tcp .: "retrans_segs"
4602+ <*> tcp .: "out_segs"
4603+ <*> tcp .: "in_segs"
4604+ <*> tcp .: "curr_estab"
4605+ <*> tcp .: "passive_opens"
4606+ <*> tcp .: "active_opens"
44524607
44534608instance FromJSON NodeThreadPoolsStats where
4454− parseJSON _ = pure NodeThreadPoolsStats
4609+ parseJSON = withObject "NodeThreadPoolsStats" parse
4610+ where
4611+ parse o = NodeThreadPoolsStats <$> o .: "snapshot"
4612+ <*> o .: "bulk"
4613+ <*> o .: "merge"
4614+ <*> o .: "get"
4615+ <*> o .: "management"
4616+ <*> o .: "fetch_shard_store"
4617+ <*> o .: "optimize"
4618+ <*> o .: "flush"
4619+ <*> o .: "search"
4620+ <*> o .: "warmer"
4621+ <*> o .: "generic"
4622+ <*> o .: "suggest"
4623+ <*> o .: "refresh"
4624+ <*> o .: "index"
4625+ <*> o .: "listener"
4626+ <*> o .: "fetch_shard_started"
4627+ <*> o .: "percolate"
4628+instance FromJSON NodeThreadPoolStats where
4629+ parseJSON = withObject "NodeThreadPoolStats" parse
4630+ where
4631+ parse o = NodeThreadPoolStats <$> o .: "completed"
4632+ <*> o .: "largest"
4633+ <*> o .: "rejected"
4634+ <*> o .: "active"
4635+ <*> o .: "queue"
4636+ <*> o .: "threads"
44554637
44564638instance FromJSON NodeJVMStats where
44574639 parseJSON _ = pure NodeJVMStats
@@ -4465,14 +4647,18 @@ instance FromJSON NodeOSStats where
44654647instance FromJSON NodeIndicesStats where
44664648 parseJSON _ = pure NodeIndicesStats
44674649
4650+instance FromJSON NodeBreakersStats where
4651+ parseJSON = withObject "NodeBreakersStats" parse
4652+ where
4653+ parse o = NodeBreakersStats <$> o .: "parent"
4654+ <*> o .: "request"
4655+ <*> o .: "fielddata"
4656+
44684657parseNodeStats :: FullNodeId -> Object -> Parser NodeStats
44694658parseNodeStats fnid o = do
4470− breakers <- o .: "breakers"
44714659 NodeStats <$> o .: "name"
44724660 <*> pure fnid
4473− <*> breakers .: "parent"
4474− <*> breakers .: "request"
4475− <*> breakers .: "fielddata"
4661+ <*> o .: "breakers"
44764662 <*> o .: "http"
44774663 <*> o .: "transport"
44784664 <*> o .: "fs"