File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import Data.Time.Clock.System (systemEpochDay)
1313import Data.Time.Format.ISO8601 (iso8601Show )
1414import Network.Socket (ServiceName )
1515import Simplex.Messaging.Server.Stats
16+ import Simplex.Messaging.Transport.Server (SocketStats (.. ))
1617
1718data ServerMetrics = ServerMetrics
1819 { statsData :: ServerStatsData ,
@@ -32,13 +33,6 @@ data RealTimeMetrics = RealTimeMetrics
3233 ntfSubClientsCount :: Int
3334 }
3435
35- data SocketStats = SocketStats
36- { socketsAccepted :: Int ,
37- socketsClosed :: Int ,
38- socketsActive :: Int ,
39- socketsLeaked :: Int
40- }
41-
4236{-# FOURMOLU_DISABLE\n#-}
4337prometheusMetrics :: ServerMetrics -> RealTimeMetrics -> UTCTime -> Text
4438prometheusMetrics sm rtm ts =
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ module Simplex.Messaging.Transport.Server
1212 runTransportServerState ,
1313 runTransportServerState_ ,
1414 SocketState ,
15+ SocketStats (.. ),
1516 newSocketState ,
1617 getSocketStats ,
1718 runTransportServer ,
@@ -44,7 +45,6 @@ import Foreign.C.Error
4445import GHC.IO.Exception (ioe_errno )
4546import Network.Socket
4647import qualified Network.TLS as T
47- import Simplex.Messaging.Server.Prometheus
4848import Simplex.Messaging.Transport
4949import Simplex.Messaging.Util (catchAll_ , labelMyThread , tshow )
5050import System.Exit (exitFailure )
@@ -165,6 +165,13 @@ safeAccept sock =
165165
166166type SocketState = (TVar Int , TVar Int , TVar (IntMap (Weak ThreadId )))
167167
168+ data SocketStats = SocketStats
169+ { socketsAccepted :: Int ,
170+ socketsClosed :: Int ,
171+ socketsActive :: Int ,
172+ socketsLeaked :: Int
173+ }
174+
168175newSocketState :: IO SocketState
169176newSocketState = (,,) <$> newTVarIO 0 <*> newTVarIO 0 <*> newTVarIO mempty
170177
You can’t perform that action at this time.
0 commit comments