Add cookbook to expose Prometheus counters.
@tchoutri :kissing:
Not sure when I'll have time to address comments, so feel free to directly edit the PR.
The code itself is inspired from what I do in prodapi.
@tchoutri any comment?
Sorry for the time, I got sidetracked by servant-quickcheck, which needed some love.
Any reason why you didn't use https://hackage.haskell.org/package/wai-middleware-prometheus for the WAI integration? I'm asking since it's part of the same family of packages as wai-middleware-prometheus.
Any reason why you didn't use https://hackage.haskell.org/package/wai-middleware-prometheus for the WAI integration? I'm asking since it's part of the same family of packages as
wai-middleware-prometheus.
Two things.
- (a) the cost of "writing your own" is low enough (as demonstrated in this example) vs. bundling "an extra dependency"
- (b) sometimes you would really benefit from parametrizing the metrics sets via query-params (e.g., to reduce network load), which is not feasible with the above package).
I haven't discussed (a), which is more of a taste/personal-experience judgment but we could add a mention as well (and maybe link to another cookbook to embed a middleware/serve a Raw Application). For (b) it's a bit motivated in the writing, adding a filtering query-param in prodapi is low on my priority list but it's quite often that I wish I had a way to reduce the prometheus payload at the server-side.
@lucasdicioccio cool, thanks for the explanation. :)
@lucasdicioccio Hi! Could you please rebase your PR on current master? This will trigger a build of the cookbook. :)
@tchoutri do you mind if I squash the diffs?
@lucasdicioccio Hi! Could you please rebase your PR on current
master? This will trigger a build of the cookbook. :)
done; I've yet to retry the whole example, sorry for the delays
@lucasdicioccio thanks! I and others will take a look. :)
@lucasdicioccio thanks! I and others will take a look. :)
if you need some changes let me know as I have a small window of opportunity opening
cc @Siprj
I like it. It is very useful to have a guide for making services more observable/resiliant :tada:.