spring-cloud / spring-cloud/spring-cloud-gateway
"spring.cloud.gateway.requests" metric not incremented for subsequent cached responses
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
I'm encountering an issue with the spring.cloud.gateway.requests metric not being incremented for subsequent calls to a route using LocalResponseCache filter.
Expected behavior
I expect the metric to be incremented for each request, regardless of whether the response is served from the cache.
Sample
- Run the attached demo-gateway.zip application.
- Call the route (http://localhost:8080/ip) using curl 5 times:
curl http://localhost:8080/ip - Check the
spring.cloud.gateway.requestsmetric using:curl http://localhost:8080/actuator/metrics/spring.cloud.gateway.requests | jq. - You will likely see that the
COUNTmeasurement remains at 1, even though the route was called 5 times.
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
Start by running the attached demo-gateway.zip application and reproducing the five curl requests through the route using the LocalResponseCache filter. Inspect how the spring.cloud.gateway.requests metric is recorded for cached responses, then query the actuator metric endpoint. Done means the COUNT reflects every request, including subsequent cache hits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- api, backend, observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100