Skip to content

Commit

Permalink
Add stats for timeouts (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccaraman authored Aug 12, 2016
1 parent a170e8b commit d545a8b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/common/http/async_client_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions test/common/http/async_client_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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* {
Expand Down

0 comments on commit d545a8b

Please sign in to comment.