From 98df84df28e26e9fd534478e34392270c27ba37c Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Fri, 16 Oct 2020 04:21:08 +0300 Subject: [PATCH] /stats endpoint --- config/routes | 2 ++ src/Application.hs | 1 + src/Handler/Stats.hs | 7 +++++++ 3 files changed, 10 insertions(+) create mode 100644 src/Handler/Stats.hs diff --git a/config/routes b/config/routes index 604f234..83d700b 100644 --- a/config/routes +++ b/config/routes @@ -61,3 +61,5 @@ /blog BlogHomeR GET /blog/#Year/#Month/#Text BlogPostR GET /blog/feed BlogFeedR GET + +/stats StatsR GET diff --git a/src/Application.hs b/src/Application.hs index 93001cf..4b7b74c 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -69,6 +69,7 @@ import Handler.Snapshots import Handler.StackageHome import Handler.StackageIndex import Handler.StackageSdist +import Handler.Stats import Handler.System --import Network.Wai.Middleware.Prometheus (prometheus) diff --git a/src/Handler/Stats.hs b/src/Handler/Stats.hs new file mode 100644 index 0000000..3fa8b34 --- /dev/null +++ b/src/Handler/Stats.hs @@ -0,0 +1,7 @@ +module Handler.Stats (getStatsR) where + +import GHC.Stats +import Import + +getStatsR :: Handler String +getStatsR = liftIO $ show <$> getRTSStats