EmbarkStudios / server-framework

Framework for running network services, opinions included
Apache License 2.0
36 stars 4 forks source link

Use correct path label for `Server::with_service` #23

Closed davidpdrsn closed 2 years ago

davidpdrsn commented 2 years ago

Checklist

Description of Changes

If you used Server::with_service (which we do for our internal release-store service, because we haven't ported it to axum yet) then the path labels in metrics would simply be /*axum_nest, instead of the actual request path.

I spent a bunch of time trying to write tests for this but ran into several issues caused by the metrics crate insisting on there only being a single global recorder. It doesn't seem like you can specify a recorder for just a scope. That means you cannot set one recorder per test and instead have to create one global PrometheusHandle stored in a static Mutex. That felt like a lot of machinery to add just to test this. So I skipped tests 😞

Related Issues

None.