Skip to content

Commit

Permalink
xds: Include max concurrent request limit in the error status for con…
Browse files Browse the repository at this point in the history
…curre… (#11845)

Include max concurrent request limit in the error status for concurrent connections limit exceeded
  • Loading branch information
kannanjgithub authored Jan 23, 2025
1 parent 495a890 commit 0f5503e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion xds/src/main/java/io/grpc/xds/ClusterImplLoadBalancer.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicLong;
Expand Down Expand Up @@ -406,7 +407,8 @@ public PickResult pickSubchannel(PickSubchannelArgs args) {
dropStats.recordDroppedRequest();
}
return PickResult.withDrop(Status.UNAVAILABLE.withDescription(
"Cluster max concurrent requests limit exceeded"));
String.format(Locale.US, "Cluster max concurrent requests limit of %d exceeded",
maxConcurrentRequests)));
}
}
final AtomicReference<ClusterLocality> clusterLocality =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ private void subtest_maxConcurrentRequests_appliedByLbConfig(boolean enableCircu
assertThat(result.getStatus().isOk()).isFalse();
assertThat(result.getStatus().getCode()).isEqualTo(Code.UNAVAILABLE);
assertThat(result.getStatus().getDescription())
.isEqualTo("Cluster max concurrent requests limit exceeded");
.isEqualTo("Cluster max concurrent requests limit of 100 exceeded");
assertThat(clusterStats.totalDroppedRequests()).isEqualTo(1L);
} else {
assertThat(result.getStatus().isOk()).isTrue();
Expand Down Expand Up @@ -667,7 +667,7 @@ private void subtest_maxConcurrentRequests_appliedByLbConfig(boolean enableCircu
assertThat(result.getStatus().isOk()).isFalse();
assertThat(result.getStatus().getCode()).isEqualTo(Code.UNAVAILABLE);
assertThat(result.getStatus().getDescription())
.isEqualTo("Cluster max concurrent requests limit exceeded");
.isEqualTo("Cluster max concurrent requests limit of 101 exceeded");
assertThat(clusterStats.totalDroppedRequests()).isEqualTo(1L);
} else {
assertThat(result.getStatus().isOk()).isTrue();
Expand Down Expand Up @@ -731,7 +731,7 @@ private void subtest_maxConcurrentRequests_appliedWithDefaultValue(
assertThat(result.getStatus().isOk()).isFalse();
assertThat(result.getStatus().getCode()).isEqualTo(Code.UNAVAILABLE);
assertThat(result.getStatus().getDescription())
.isEqualTo("Cluster max concurrent requests limit exceeded");
.isEqualTo("Cluster max concurrent requests limit of 1024 exceeded");
assertThat(clusterStats.totalDroppedRequests()).isEqualTo(1L);
} else {
assertThat(result.getStatus().isOk()).isTrue();
Expand Down

0 comments on commit 0f5503e

Please sign in to comment.