diff --git a/src/Application.hs b/src/Application.hs index cfa04f60a..5f6ff7bc9 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -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 diff --git a/src/Foundation/Type.hs b/src/Foundation/Type.hs index 8a4a38c23..0c7468be1 100644 --- a/src/Foundation/Type.hs +++ b/src/Foundation/Type.hs @@ -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 diff --git a/src/Handler/Health.hs b/src/Handler/Health.hs index d4c7194cd..a45efdc35 100644 --- a/src/Handler/Health.hs +++ b/src/Handler/Health.hs @@ -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
- Current Time #{show currtime}
+ Current Time
+ #{show currtime}
- Compile Time #{comptime}
+ Instance Start
+ #{show starttime}
+
+ Compile Time
+ #{comptime}
+
+ Instance running time is #{show $ ddays starttime currtime} days. $maybe ctime <- readMay comptime
- 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