Skip to content

Commit d545a8b

Browse files
authored
Add stats for timeouts (#10)
1 parent a170e8b commit d545a8b

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

source/common/http/async_client_impl.cc

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ void AsyncRequestImpl::onRequestTimeout() {
126126
REQUEST_TIMEOUT_HEADER, true, EMPTY_STRING,
127127
EMPTY_STRING};
128128
Http::CodeUtility::chargeResponseStat(info);
129+
parent_.stats_store_.counter(fmt::format("{}upstream_rq_timeout", parent_.stat_prefix_)).inc();
129130
stream_encoder_->resetStream();
130131
cleanup();
131132
callbacks_.onFailure(Http::AsyncClient::FailureReason::RequestTimemout);

test/common/http/async_client_impl_test.cc

+1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ TEST_F(AsyncClientImplTest, RequestTimeout) {
151151
EXPECT_CALL(stats_store_, counter("cluster.fake_cluster.upstream_rq_504"));
152152
EXPECT_CALL(stats_store_, counter("cluster.fake_cluster.internal.upstream_rq_5xx"));
153153
EXPECT_CALL(stats_store_, counter("cluster.fake_cluster.internal.upstream_rq_504"));
154+
EXPECT_CALL(stats_store_, counter("cluster.fake_cluster.upstream_rq_timeout"));
154155
EXPECT_CALL(conn_pool_, newStream(_, _))
155156
.WillOnce(Invoke([&](StreamDecoder&, ConnectionPool::Callbacks& callbacks)
156157
-> ConnectionPool::Cancellable* {

0 commit comments

Comments
 (0)