feat(status): show instance running time
This commit is contained in:
parent
71950d9e5c
commit
8743719183
@ -207,6 +207,7 @@ makeFoundation appSettings''@AppSettings{..} = do
|
|||||||
for_ (guardOnM (isn't _JobsOffload appJobMode) appInjectFiles) $ \_ ->
|
for_ (guardOnM (isn't _JobsOffload appJobMode) appInjectFiles) $ \_ ->
|
||||||
void . Prometheus.register $ injectInhibitMetrics appFileInjectInhibit
|
void . Prometheus.register $ injectInhibitMetrics appFileInjectInhibit
|
||||||
|
|
||||||
|
appStartTime <- liftIO getCurrentTime
|
||||||
-- We need a log function to create a connection pool. We need a connection
|
-- We need a log function to create a connection pool. We need a connection
|
||||||
-- pool to create our foundation. And we need our foundation to get a
|
-- pool to create our foundation. And we need our foundation to get a
|
||||||
-- logging function. To get out of this loop, we initially create a
|
-- logging function. To get out of this loop, we initially create a
|
||||||
|
|||||||
@ -96,6 +96,7 @@ data UniWorX = UniWorX
|
|||||||
, appFileInjectInhibit :: TVar (IntervalMap UTCTime (Set FileContentReference))
|
, appFileInjectInhibit :: TVar (IntervalMap UTCTime (Set FileContentReference))
|
||||||
, appPersonalisedSheetFilesSeedKey :: PersonalisedSheetFilesSeedKey
|
, appPersonalisedSheetFilesSeedKey :: PersonalisedSheetFilesSeedKey
|
||||||
, appVolatileClusterSettingsCache :: TVar VolatileClusterSettingsCache
|
, appVolatileClusterSettingsCache :: TVar VolatileClusterSettingsCache
|
||||||
|
, appStartTime :: UTCTime -- for Status Page
|
||||||
} deriving (Typeable)
|
} deriving (Typeable)
|
||||||
|
|
||||||
makeLenses_ ''UniWorX
|
makeLenses_ ''UniWorX
|
||||||
|
|||||||
@ -102,6 +102,7 @@ getInstanceR = do
|
|||||||
-- Most simple page for simple liveness checks
|
-- Most simple page for simple liveness checks
|
||||||
getStatusR :: Handler Html
|
getStatusR :: Handler Html
|
||||||
getStatusR = do
|
getStatusR = do
|
||||||
|
starttime <- getsYesod appStartTime
|
||||||
currtime <- liftIO getCurrentTime
|
currtime <- liftIO getCurrentTime
|
||||||
withUrlRenderer
|
withUrlRenderer
|
||||||
[hamlet|
|
[hamlet|
|
||||||
@ -111,12 +112,19 @@ getStatusR = do
|
|||||||
<title>Status
|
<title>Status
|
||||||
<body>
|
<body>
|
||||||
<p>
|
<p>
|
||||||
Current Time #{show currtime}
|
Current Time <br>
|
||||||
|
#{show currtime}
|
||||||
<p>
|
<p>
|
||||||
Compile Time #{comptime}
|
Instance Start <br>
|
||||||
|
#{show starttime}
|
||||||
|
<p>
|
||||||
|
Compile Time <br>
|
||||||
|
#{comptime}
|
||||||
|
<p>
|
||||||
|
Instance running time is #{show $ ddays starttime currtime} days.
|
||||||
$maybe ctime <- readMay comptime
|
$maybe ctime <- readMay comptime
|
||||||
<p>
|
<p>
|
||||||
Build is #{show $ ddays ctime currtime} days old
|
Build is #{show $ ddays ctime currtime} days old.
|
||||||
|]
|
|]
|
||||||
where
|
where
|
||||||
-- vnr_full :: Text = $(embedStringFile "nix/docker/version.json") -- nix/ files not accessible during container construction
|
-- vnr_full :: Text = $(embedStringFile "nix/docker/version.json") -- nix/ files not accessible during container construction
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user