micronaut-micrometer icon indicating copy to clipboard operation
micronaut-micrometer copied to clipboard

URI_TEMPLATE not set for pre-flight requests

Open luckyswede opened this issue 5 years ago • 6 comments

Hi! OPTIONS-requests do not get URI_TEMPLATE set which results in an ever growing list of uri tags for http.server.request metrics and may cause OOM in the end for routes with dynamic path segments. The reason is that URI_TEMPLATE is set in RoutingInBoundHandler which runs after the CorsFilter.

Micronaut 2.0.3

luckyswede avatar Oct 06 '20 17:10 luckyswede

My workaround for now is a micrometer MeterFilter that removes metrics with method=="OPTIONS"

luckyswede avatar Oct 06 '20 18:10 luckyswede

Do you have an example that reproduces the issue?

graemerocher avatar Oct 06 '20 18:10 graemerocher

Here u go: https://github.com/luckyswede/micronaut-options-metrics

luckyswede avatar Oct 07 '20 07:10 luckyswede

@luckyswede The URI_TEMPLATE is set before the filter, however the issue is that no route matches the OPTIONS request, therefore the uri template is not set because there is no route to get it from.

jameskleeh avatar Oct 07 '20 21:10 jameskleeh

Transferred this to micrometer because I don't think we can do anything about this in core. Perhaps a config option or something can be added to ignore OPTIONS

jameskleeh avatar Dec 02 '20 18:12 jameskleeh

@n0tl3ss related issue to the previous one

graemerocher avatar Jun 02 '22 15:06 graemerocher