How to produce metrics of URI correctly in spring boot 2 + webflux


How to produce metrics of URI correctly in spring boot 2 + webflux



I have a problem using spring boot 2.0.3 + spring webflux (functional endpoints) + metrics. According to the official doc:



The generated metrics of uri should be the request’s URI template prior to variable substitution



Which means instead of /api/person/123, the generated metrics of URI should be something like /api/person/{id}. However, when I query those metrics on my spring boot app with this link http://localhost:8080/actuator/metrics/http.server.requests, I got these URIs:



/api/person/2
/api/person/33
/api/person/12



To reproduce this issue, I put a sample code here: https://gitlab.com/itsleon/demo



Can someone please shed some light on this issue? Thanks in advance!




1 Answer
1



There's an open issue for that in Spring Boot.
Currently, Spring WebFlux fn doesn't provide the information about the URI pattern that matched for the current request, so there's no way to achieve that currently.



Your assessment is correct, currently the full request URIs are collected.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

Display dokan vendor name on Woocommerce single product pages