Skip to content

Commit

Permalink
Record more route duration metrics with prometheus
Browse files Browse the repository at this point in the history
  • Loading branch information
tchoutri committed Dec 29, 2024
1 parent 521f19c commit c43625e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,8 @@ source-repository-package
type: git
location: https://github.com/goodlyrottenapple/tasty-test-reporter
tag: b704130

source-repository-package
type: git
location: https://github.com/worm2fed/servant-prometheus
tag: 9f967b3b42b183653b91f0ba9097621797ad107d
1 change: 1 addition & 0 deletions flora.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ library flora-web
, wai-log
, wai-middleware-heartbeat
, wai-middleware-prometheus
, servant-prometheus
, warp
, xml-conduit
, xml-conduit-writer
Expand Down
8 changes: 4 additions & 4 deletions src/web/FloraWeb/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ import Network.Wai.Handler.Warp
, setPort
)
import Network.Wai.Log qualified as WaiLog
import Network.Wai.Middleware.Prometheus qualified as WaiMetrics
import Network.Wai.Middleware.Heartbeat (heartbeatMiddleware)
import Network.Wai.Middleware.Prometheus qualified as P
import OddJobs.Endpoints qualified as OddJobs
import Prometheus.Servant qualified as P
import OddJobs.Job (startJobRunner)
import OddJobs.Types qualified as OddJobs
import Optics.Core
Expand Down Expand Up @@ -177,9 +178,8 @@ runServer appLogger floraEnv = do
$ heartbeatMiddleware
. loggingMiddleware
. const
$ P.prometheus
P.def
server
$ WaiMetrics.prometheus WaiMetrics.def
$ P.prometheusMiddleware P.defaultMetrics (Proxy @ServerRoutes) server

mkServer
:: Logger
Expand Down

0 comments on commit c43625e

Please sign in to comment.