tower-web icon indicating copy to clipboard operation
tower-web copied to clipboard

Metrics

Open carllerche opened this issue 7 years ago • 4 comments

carllerche avatar Jul 30 '18 15:07 carllerche

Do you have a metrics backend in mind that you are interested in supporting?

stuartnelson3 avatar Aug 26 '18 18:08 stuartnelson3

Or even a set of metrics, which would lead to being able to decide what backend is useful 😇

Note that there is a log middleware which has some amount of overlap with the general umbrella of "metrics".

shepmaster avatar Aug 26 '18 19:08 shepmaster

I would recommend following RED -- it's going to expose all of the metrics info that should be relevant to every webapp. Rate, Errors, and Duration, each partitioned by path/method/status code, and potentially resource name.

Generally metrics, logging, and tracing fall under the "observability" umbrella. In the case of tower-web, I think per route rate/errors/duration metrics could very easily be gathered as it's own middleware, as @shepmaster suggests.

I would be happy to contribute a prometheus middleware, if there were interest. I'm somewhat biased towards that backend since I'm a part of the project, though.

stuartnelson3 avatar Aug 27 '18 01:08 stuartnelson3

This relates to https://github.com/tokio-rs/tokio/issues/561. In the long run, I would like tower-web to emit Tokio trace events on a per route basis... this would enable the most flexibility.

@stuartnelson3 either way, a prometheus Tower middleware would be 👍

carllerche avatar Aug 28 '18 01:08 carllerche