From c596491e494eaf09c917b7af57294530a8ceb219 Mon Sep 17 00:00:00 2001 From: Steffen Jost Date: Wed, 12 Jul 2023 08:21:31 +0000 Subject: [PATCH] chore(health): add more info to health --- src/Foundation/I18n.hs | 2 +- src/Handler/Health.hs | 27 ++++++++------------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/Foundation/I18n.hs b/src/Foundation/I18n.hs index 9f093d135..4651944ad 100644 --- a/src/Foundation/I18n.hs +++ b/src/Foundation/I18n.hs @@ -247,7 +247,6 @@ mkMessageVariant ''UniWorX ''PWHashMessage "messages/auth/pw-hash" "de" mkMessageVariant ''UniWorX ''ButtonMessage "messages/button" "de" mkMessageVariant ''UniWorX ''FrontendMessage "messages/frontend" "de-de-formal" -embedRenderMessage ''UniWorX ''HealthCheck id -- not possible here embedRenderMessage ''UniWorX ''AvsLicence id -- required by UniWorXAvsMessages mkMessageAddition ''UniWorX "Qualification" "messages/uniworx/categories/qualification" "de-de-formal" mkMessageAddition ''UniWorX "Avs" "messages/uniworx/categories/avs" "de-de-formal" @@ -317,6 +316,7 @@ appLanguagesOpts = do langOptions = map mkOption $ toList appLanguages return $ mkOptionList langOptions +embedRenderMessage ''UniWorX ''HealthCheck id embedRenderMessage ''UniWorX ''MessageStatus ("Message" <>) embedRenderMessage ''UniWorX ''NotificationTrigger $ ("NotificationTrigger" <>) . concat . drop 1 . splitCamel embedRenderMessage ''UniWorX ''StudyFieldType id diff --git a/src/Handler/Health.hs b/src/Handler/Health.hs index 3fd4a1c99..b19e90a7e 100644 --- a/src/Handler/Health.hs +++ b/src/Handler/Health.hs @@ -6,7 +6,7 @@ module Handler.Health where import Import --- import Handler.Utils +import Handler.Utils.DateTime (formatTimeW) import qualified Data.Aeson.Encode.Pretty as Aeson import qualified Data.Text.Lazy.Builder as Builder @@ -65,33 +65,22 @@ getHealthR = do _{MsgMessageError}
- $forall (_, report) <- healthReports' - $with hcclass = classifyHealthReport report - $with hcstatus = HealthSuccess == healthReportStatus report + $forall (lUp, report) <- healthReports' + $with hcclass <- classifyHealthReport report + $with hcstatus <- HealthSuccess == healthReportStatus report $case report - $of HealthMatchingClusterConfig passed -
_{MsgHealthCheckMatchingClusterConfig} -
#{boolSymbol passed} - $of HealthHTTPReachable (Just passed) -
_{MsgHealthCheckHTTPReachable} -
#{boolSymbol passed} $of HealthLDAPAdmins (Just found)
_{MsgHealthCheckLDAPAdmins}
#{textPercent found 1} - $of HealthSMTPConnect (Just passed) -
_{MsgHealthCheckSMTPConnect} -
#{boolSymbol passed} - $of HealthWidgetMemcached (Just passed) -
_{MsgHealthCheckWidgetMemcached} -
#{boolSymbol passed} + \ ^{formatTimeW SelFormatDateTime lUp} $of HealthActiveJobExecutors (Just active)
_{MsgHealthCheckActiveJobExecutors}
#{textPercent active 1} - $of HealthDoesFlush mProp + \ ^{formatTimeW SelFormatDateTime lUp} + $of _
_{hcclass}
#{boolSymbol hcstatus} - $of _ - + \ ^{formatTimeW SelFormatDateTime lUp} |] provideJson healthReports provideRep . return . Builder.toLazyText $ Aeson.encodePrettyToTextBuilder healthReports