Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record more route duration metrics with prometheus #810

Merged
merged 2 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 2 additions & 0 deletions changelog.d/810
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
synopsis: Record more route duration metrics with prometheus
prs: #810
1 change: 1 addition & 0 deletions flora.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ library flora-web
, servant-client
, servant-client-core
, servant-openapi3
, servant-prometheus
, servant-server
, text
, text-display
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 @@ -33,14 +33,15 @@ import Network.Wai.Handler.Warp
)
import Network.Wai.Log qualified as WaiLog
import Network.Wai.Middleware.Heartbeat (heartbeatMiddleware)
import Network.Wai.Middleware.Prometheus qualified as P
import Network.Wai.Middleware.Prometheus qualified as WaiMetrics
import OddJobs.Endpoints qualified as OddJobs
import OddJobs.Job (startJobRunner)
import OddJobs.Types qualified as OddJobs
import Optics.Core
import Prometheus qualified as P
import Prometheus.Metric.GHC qualified as P
import Prometheus.Metric.Proc qualified as P
import Prometheus.Servant qualified as P
import Sel
import Servant
( Application
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
Loading