server: report metrics API status from config API

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5599
GitOrigin-RevId: b66eb5c3a0034fe5ab7c764b34f7def77edd3fc0
This commit is contained in:
awjchen 2022-09-27 00:48:21 -06:00 committed by hasura-bot
parent 8e600362e7
commit 8e05e51f1b
2 changed files with 10 additions and 2 deletions

View File

@ -15,6 +15,7 @@ import Hasura.GraphQL.Schema.Options qualified as Options
import Hasura.Prelude
import Hasura.Server.Auth
import Hasura.Server.Auth.JWT
import Hasura.Server.Init.Config (API (METRICS))
import Hasura.Server.Types (ExperimentalFeature)
import Hasura.Server.Version (Version, currentVersion)
@ -39,7 +40,8 @@ data ServerConfig = ServerConfig
scfgLiveQueries :: !ES.LiveQueriesOptions,
scfgStreamingQueries :: !ES.SubscriptionsOptions,
scfgConsoleAssetsDir :: !(Maybe Text),
scfgExperimentalFeatures :: !(Set.HashSet ExperimentalFeature)
scfgExperimentalFeatures :: !(Set.HashSet ExperimentalFeature),
scfgIsPrometheusMetricsEnabled :: !Bool
}
deriving (Show, Eq)
@ -54,6 +56,7 @@ runGetConfig ::
ES.SubscriptionsOptions ->
Maybe Text ->
Set.HashSet ExperimentalFeature ->
Set.HashSet API ->
ServerConfig
runGetConfig
functionPermsCtx
@ -63,7 +66,8 @@ runGetConfig
liveQueryOpts
streamQueryOpts
consoleAssetsDir
experimentalFeatures =
experimentalFeatures
enabledAPIs =
ServerConfig
currentVersion
functionPermsCtx
@ -77,6 +81,9 @@ runGetConfig
streamQueryOpts
consoleAssetsDir
experimentalFeatures
isPrometheusMetricsEnabled
where
isPrometheusMetricsEnabled = METRICS `Set.member` enabledAPIs
isAdminSecretSet :: AuthMode -> Bool
isAdminSecretSet = \case

View File

@ -715,6 +715,7 @@ configApiGetHandler serverCtx@ServerCtx {..} consoleAssetsDir =
(ES._ssStreamQueryOptions $ scSubscriptionState)
consoleAssetsDir
scExperimentalFeatures
scEnabledAPIs
return (emptyHttpLogMetadata @m, JSONResp $ HttpResponse (encJFromJValue res) [])
data HasuraApp = HasuraApp