tower-web
tower-web copied to clipboard
Metrics
Do you have a metrics backend in mind that you are interested in supporting?
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".
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.
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 👍