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

Active client requests metric is not decreased in case of cancelled request

Open
#3,609 1 comment 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
Hello, I'm experiencing an issue with Spring Cloud Gateway where the http_client_requests_active_seconds_count metric does not decrease when an inbound HTTP request is cancelled by the client. This leads to an inaccurate count of active client requests, which increases indefinitely with each cancelled request.

Environment:

  • Spring Boot Version: 3.3.6
  • Spring Cloud Version: 2023.0.4
  • Spring Cloud Gateway Version: 4.1.6

Sample
Please see demo project with steps to reproduce.

Expected behaviour
The http_client_requests_active_seconds_count metric should decrement when a client cancels an inbound HTTP request, accurately reflecting the number of active outbound client requests.

Is this a known issue with Spring Cloud Gateway or Micrometer? Are there any recommended workarounds or configurations to ensure the metric decrements upon request cancellation?

Thank you for your assistance in resolving this issue.

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 with the linked active-client-requests-metric-demo project and follow its reproduction steps for an inbound HTTP request cancelled by the client. Trace the Spring Cloud Gateway and Micrometer request-metric handling involved, then verify that http_client_requests_active_seconds_count decrements after cancellation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.