spring-cloud-gateway icon indicating copy to clipboard operation
spring-cloud-gateway copied to clipboard

GatewayMetricsFilter should have Ordered.HIGHEST_PRECEDENCE

Open usrivastava92 opened this issue 1 year ago • 0 comments

Describe the bug GatewayMetricsFilter currently runs with order NettyWriteResponseFilter.WRITE_RESPONSE_FILTER_ORDER + 1 I kind of understand the reasoning behind this, since NettyWriteResponseFilter flushes the response to client that is the reason we want to stop timer before we flush the response, but this has following caveats:

  • We are missing on the time taken by pre-filters that run before GatewayMetricsFilter i.e. filter with higher precedence than GatewayMetricsFilter
  • On doing this we might start adding extra time to duration metrics as this is start including the time taken by post filters that execute after GatewayMetricsFilter, but considering the face that likelihood of doing post processing after flushing response to client is pretty low, the duration overhead will be very minimal.

Sample Screenshot 2024-05-31 at 3 44 16 PM

usrivastava92 avatar May 31 '24 10:05 usrivastava92