servant icon indicating copy to clipboard operation
servant copied to clipboard

Add cookbook to expose Prometheus counters.

Open lucasdicioccio opened this issue 1 year ago • 4 comments

@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.

lucasdicioccio avatar Mar 17 '24 13:03 lucasdicioccio

@tchoutri any comment?

lucasdicioccio avatar Apr 05 '24 06:04 lucasdicioccio

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.

tchoutri avatar Apr 05 '24 08:04 tchoutri

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 avatar Apr 05 '24 10:04 lucasdicioccio

@lucasdicioccio cool, thanks for the explanation. :)

tchoutri avatar Apr 05 '24 10:04 tchoutri

@lucasdicioccio Hi! Could you please rebase your PR on current master? This will trigger a build of the cookbook. :)

tchoutri avatar Jan 23 '25 13:01 tchoutri

@tchoutri do you mind if I squash the diffs?

lucasdicioccio avatar Jan 28 '25 08:01 lucasdicioccio

@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 avatar Feb 04 '25 16:02 lucasdicioccio

@lucasdicioccio thanks! I and others will take a look. :)

tchoutri avatar Feb 05 '25 14:02 tchoutri

@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

lucasdicioccio avatar Feb 13 '25 23:02 lucasdicioccio

cc @Siprj

tchoutri avatar Feb 14 '25 13:02 tchoutri

I like it. It is very useful to have a guide for making services more observable/resiliant :tada:.

Siprj avatar Feb 17 '25 12:02 Siprj