spring-cloud / spring-cloud/spring-cloud-gateway
GatewayMetricsFilter should have Ordered.HIGHEST_PRECEDENCE
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
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
GatewayMetricsFilteri.e. filter with higher precedence thanGatewayMetricsFilter - 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate GatewayMetricsFilter and NettyWriteResponseFilter, then inspect their filter ordering and how the metrics timer is stopped relative to response flushing. Confirm that the intended behavior includes higher-precedence pre-filters while preserving the response-flush behavior, and validate the change with the relevant gateway tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend, observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100