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) $ \_ ->
|
||||
void . Prometheus.register $ injectInhibitMetrics appFileInjectInhibit
|
||||
|
||||
appStartTime <- liftIO getCurrentTime
|
||||
-- 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
|
||||
-- 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))
|
||||
, appPersonalisedSheetFilesSeedKey :: PersonalisedSheetFilesSeedKey
|
||||
, appVolatileClusterSettingsCache :: TVar VolatileClusterSettingsCache
|
||||
, appStartTime :: UTCTime -- for Status Page
|
||||
} deriving (Typeable)
|
||||
|
||||
makeLenses_ ''UniWorX
|
||||
|
||||
@ -102,6 +102,7 @@ getInstanceR = do
|
||||
-- Most simple page for simple liveness checks
|
||||
getStatusR :: Handler Html
|
||||
getStatusR = do
|
||||
starttime <- getsYesod appStartTime
|
||||
currtime <- liftIO getCurrentTime
|
||||
withUrlRenderer
|
||||
[hamlet|
|
||||
@ -111,12 +112,19 @@ getStatusR = do
|
||||
<title>Status
|
||||
<body>
|
||||
<p>
|
||||
Current Time #{show currtime}
|
||||
Current Time <br>
|
||||
#{show currtime}
|
||||
<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
|
||||
<p>
|
||||
Build is #{show $ ddays ctime currtime} days old
|
||||
Build is #{show $ ddays ctime currtime} days old.
|
||||
|]
|
||||
where
|
||||
-- vnr_full :: Text = $(embedStringFile "nix/docker/version.json") -- nix/ files not accessible during container construction
|
||||
|
||||
Loading…
Reference in New Issue
Block a user