spring-cloud / spring-cloud/spring-cloud-gateway

"spring.cloud.gateway.requests" metric not incremented for subsequent cached responses

Open
#3,347 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
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

  1. Run the attached demo-gateway.zip application.
  2. Call the route (http://localhost:8080/ip) using curl 5 times: curl http://localhost:8080/ip
  3. Check the spring.cloud.gateway.requests metric using: curl http://localhost:8080/actuator/metrics/spring.cloud.gateway.requests | jq.
  4. You will likely see that the COUNT measurement remains at 1, even though the route was called 5 times.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.