diff --git a/source/common/http/async_client_impl.cc b/source/common/http/async_client_impl.cc index 09f1ffe79583..5d2911b4f6c5 100644 --- a/source/common/http/async_client_impl.cc +++ b/source/common/http/async_client_impl.cc @@ -126,6 +126,7 @@ void AsyncRequestImpl::onRequestTimeout() { REQUEST_TIMEOUT_HEADER, true, EMPTY_STRING, EMPTY_STRING}; Http::CodeUtility::chargeResponseStat(info); + parent_.stats_store_.counter(fmt::format("{}upstream_rq_timeout", parent_.stat_prefix_)).inc(); stream_encoder_->resetStream(); cleanup(); callbacks_.onFailure(Http::AsyncClient::FailureReason::RequestTimemout); diff --git a/test/common/http/async_client_impl_test.cc b/test/common/http/async_client_impl_test.cc index e15d0f4a9cb7..f306c34c9b4a 100644 --- a/test/common/http/async_client_impl_test.cc +++ b/test/common/http/async_client_impl_test.cc @@ -151,6 +151,7 @@ TEST_F(AsyncClientImplTest, RequestTimeout) { EXPECT_CALL(stats_store_, counter("cluster.fake_cluster.upstream_rq_504")); EXPECT_CALL(stats_store_, counter("cluster.fake_cluster.internal.upstream_rq_5xx")); EXPECT_CALL(stats_store_, counter("cluster.fake_cluster.internal.upstream_rq_504")); + EXPECT_CALL(stats_store_, counter("cluster.fake_cluster.upstream_rq_timeout")); EXPECT_CALL(conn_pool_, newStream(_, _)) .WillOnce(Invoke([&](StreamDecoder&, ConnectionPool::Callbacks& callbacks) -> ConnectionPool::Cancellable* {