mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
Merge pull request #5746 from paf31/ekg-rts-metrics
https://github.com/hasura/graphql-engine/pull/5746
This commit is contained in:
commit
a544f7636c
@ -483,6 +483,7 @@ executable graphql-engine
|
||||
, pg-client
|
||||
, text
|
||||
, text-conversions
|
||||
, time
|
||||
, unix
|
||||
, ekg-core
|
||||
|
||||
|
@ -3,7 +3,9 @@
|
||||
module Main where
|
||||
|
||||
import Control.Exception
|
||||
import Data.Int (Int64)
|
||||
import Data.Text.Conversions (convertText)
|
||||
import Data.Time.Clock.POSIX (getPOSIXTime)
|
||||
|
||||
import Hasura.App
|
||||
import Hasura.Logging (Hasura)
|
||||
@ -42,7 +44,17 @@ runApp env (HGEOptionsG rci hgeCmd) =
|
||||
withVersion $$(getVersionFromEnvironment) $ case hgeCmd of
|
||||
HCServe serveOptions -> do
|
||||
(initCtx, initTime) <- initialiseCtx env hgeCmd rci
|
||||
ekgStore <- liftIO EKG.newStore
|
||||
|
||||
ekgStore <- liftIO do
|
||||
s <- EKG.newStore
|
||||
EKG.registerGcMetrics s
|
||||
|
||||
let getTimeMs :: IO Int64
|
||||
getTimeMs = (round . (* 1000)) `fmap` getPOSIXTime
|
||||
|
||||
EKG.registerCounter "ekg.server_timestamp_ms" getTimeMs s
|
||||
pure s
|
||||
|
||||
let shutdownApp = return ()
|
||||
-- Catches the SIGTERM signal and initiates a graceful shutdown.
|
||||
-- Graceful shutdown for regular HTTP requests is already implemented in
|
||||
|
@ -11,10 +11,8 @@ import Hasura.Prelude hiding (get, put)
|
||||
|
||||
import Control.Monad.Stateless
|
||||
import Data.Aeson hiding (json)
|
||||
import Data.Int (Int64)
|
||||
import Data.IORef
|
||||
import Data.Time.Clock (UTCTime)
|
||||
import Data.Time.Clock.POSIX (getPOSIXTime)
|
||||
import Network.Mime (defaultMimeLookup)
|
||||
import System.FilePath (joinPath, takeFileName)
|
||||
import Web.Spock.Core ((<//>))
|
||||
@ -635,10 +633,6 @@ mkWaiApp env isoLevel logger sqlGenCtx enableAL pool pgExecCtxCustom ci httpMana
|
||||
, scResponseInternalErrorsConfig = responseErrorsConfig
|
||||
}
|
||||
|
||||
when (isDeveloperAPIEnabled serverCtx) $ do
|
||||
liftIO $ EKG.registerGcMetrics ekgStore
|
||||
liftIO $ EKG.registerCounter "ekg.server_timestamp_ms" getTimeMs ekgStore
|
||||
|
||||
spockApp <- liftWithStateless $ \lowerIO ->
|
||||
Spock.spockAsApp $ Spock.spockT lowerIO $
|
||||
httpApp corsCfg serverCtx enableConsole consoleAssetsDir enableTelemetry
|
||||
@ -651,9 +645,6 @@ mkWaiApp env isoLevel logger sqlGenCtx enableAL pool pgExecCtxCustom ci httpMana
|
||||
|
||||
return $ HasuraApp waiApp schemaCacheRef cacheBuiltTime stopWSServer
|
||||
where
|
||||
getTimeMs :: IO Int64
|
||||
getTimeMs = (round . (* 1000)) `fmap` getPOSIXTime
|
||||
|
||||
-- initialiseCache :: m (E.PlanCache, SchemaCacheRef)
|
||||
initialiseCache :: m SchemaCacheRef
|
||||
initialiseCache = do
|
||||
|
Loading…
Reference in New Issue
Block a user