Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http: tracking 100s from upstream in stats #6746

Merged
merged 2 commits into from
Apr 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions source/common/router/router.cc
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,9 @@ void Filter::handleNon5xxResponseHeaders(const Http::HeaderMap& headers,
}
}

void Filter::onUpstream100ContinueHeaders(Http::HeaderMapPtr&& headers) {
void Filter::onUpstream100ContinueHeaders(Http::HeaderMapPtr&& headers,
UpstreamRequest& upstream_request) {
chargeUpstreamCode(100, *headers, upstream_request.upstream_host_, false);
ENVOY_STREAM_LOG(debug, "upstream 100 continue", *callbacks_);

downstream_response_started_ = true;
Expand Down Expand Up @@ -1030,7 +1032,7 @@ Filter::UpstreamRequest::~UpstreamRequest() {

void Filter::UpstreamRequest::decode100ContinueHeaders(Http::HeaderMapPtr&& headers) {
ASSERT(100 == Http::Utility::getResponseStatus(*headers));
parent_.onUpstream100ContinueHeaders(std::move(headers));
parent_.onUpstream100ContinueHeaders(std::move(headers), *this);
}

void Filter::UpstreamRequest::decodeHeaders(Http::HeaderMapPtr&& headers, bool end_stream) {
Expand Down
3 changes: 2 additions & 1 deletion source/common/router/router.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ class Filter : Logger::Loggable<Logger::Id::router>,
void onPerTryTimeout(UpstreamRequest& upstream_request);
void onRequestComplete();
void onResponseTimeout();
void onUpstream100ContinueHeaders(Http::HeaderMapPtr&& headers);
void onUpstream100ContinueHeaders(Http::HeaderMapPtr&& headers,
UpstreamRequest& upstream_request);
// Handle an upstream request aborted due to a local timeout.
void onUpstreamTimeoutAbort(StreamInfo::ResponseFlag response_flag);
// Handle an "aborted" upstream request, meaning we didn't see response
Expand Down
3 changes: 3 additions & 0 deletions test/common/router/router_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,9 @@ TEST_F(RouterTest, RetryUpstreamReset100ContinueResponseStarted) {
EXPECT_CALL(callbacks_, encode100ContinueHeaders_(_));
Http::HeaderMapPtr continue_headers(new Http::TestHeaderMapImpl{{":status", "100"}});
response_decoder->decode100ContinueHeaders(std::move(continue_headers));
EXPECT_EQ(
1U,
cm_.thread_local_cluster_.cluster_.info_->stats_store_.counter("upstream_rq_100").value());
EXPECT_CALL(cm_.conn_pool_.host_->outlier_detector_, putHttpResponseCode(503));
encoder1.stream_.resetStream(Http::StreamResetReason::RemoteReset);
}
Expand Down