Skip to content
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
30 changes: 14 additions & 16 deletions source/common/router/router.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,6 @@ void Filter::chargeUpstreamCode(uint64_t response_status_code,
const bool internal_request =
internal_request_header && internal_request_header->value() == "true";

// TODO(mattklein123): Remove copy when G string compat issues are fixed.
const std::string zone_name = config_.local_info_.zoneName();
const std::string upstream_zone = upstreamZone(upstream_host);

Http::CodeStats::ResponseStatInfo info{config_.scope_,
cluster_->statsScope(),
EMPTY_STRING,
Expand All @@ -228,19 +224,24 @@ void Filter::chargeUpstreamCode(uint64_t response_status_code,
route_entry_->virtualHost().name(),
request_vcluster_ ? request_vcluster_->name()
: EMPTY_STRING,
zone_name,
upstream_zone,
config_.local_info_.zoneName(),
upstreamZone(upstream_host),
is_canary};

Http::CodeStats& code_stats = httpContext().codeStats();
code_stats.chargeResponseStat(info);

if (!alt_stat_prefix_.empty()) {
Http::CodeStats::ResponseStatInfo info{config_.scope_, cluster_->statsScope(),
alt_stat_prefix_, response_status_code,
internal_request, EMPTY_STRING,
EMPTY_STRING, zone_name,
upstream_zone, is_canary};
Http::CodeStats::ResponseStatInfo info{config_.scope_,
cluster_->statsScope(),
alt_stat_prefix_,
response_status_code,
internal_request,
EMPTY_STRING,
EMPTY_STRING,
config_.local_info_.zoneName(),
upstreamZone(upstream_host),
is_canary};

code_stats.chargeResponseStat(info);
}
Expand Down Expand Up @@ -884,9 +885,6 @@ void Filter::onUpstreamComplete(UpstreamRequest& upstream_request) {
const bool internal_request =
internal_request_header && internal_request_header->value() == "true";

// TODO(mattklein123): Remove copy when G string compat issues are fixed.
const std::string zone_name = config_.local_info_.zoneName();

Http::CodeStats& code_stats = httpContext().codeStats();
Http::CodeStats::ResponseTimingInfo info{config_.scope_,
cluster_->statsScope(),
Expand All @@ -897,7 +895,7 @@ void Filter::onUpstreamComplete(UpstreamRequest& upstream_request) {
route_entry_->virtualHost().name(),
request_vcluster_ ? request_vcluster_->name()
: EMPTY_STRING,
zone_name,
config_.local_info_.zoneName(),
upstreamZone(upstream_request.upstream_host_)};

code_stats.chargeResponseTiming(info);
Expand All @@ -911,7 +909,7 @@ void Filter::onUpstreamComplete(UpstreamRequest& upstream_request) {
internal_request,
EMPTY_STRING,
EMPTY_STRING,
zone_name,
config_.local_info_.zoneName(),
upstreamZone(upstream_request.upstream_host_)};

code_stats.chargeResponseTiming(info);
Expand Down
11 changes: 4 additions & 7 deletions test/extensions/transport_sockets/tls/ssl_socket_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -538,13 +538,10 @@ const std::string testUtilV2(const TestUtilOptionsV2& options) {
Network::MockConnectionCallbacks server_connection_callbacks;
EXPECT_CALL(callbacks, onAccept_(_, _))
.WillOnce(Invoke([&](Network::ConnectionSocketPtr& socket, bool) -> void {
// TODO(htuch): remove std::string(..) wrappers when Google's string
// implementation converges with std::string.
std::string sni =
options.transportSocketOptions() != NULL &&
options.transportSocketOptions()->serverNameOverride().has_value()
? std::string(options.transportSocketOptions()->serverNameOverride().value())
: std::string(options.clientCtxProto().sni());
std::string sni = options.transportSocketOptions() != NULL &&
options.transportSocketOptions()->serverNameOverride().has_value()
? options.transportSocketOptions()->serverNameOverride().value()
: options.clientCtxProto().sni();
socket->setRequestedServerName(sni);
Network::ConnectionPtr new_connection = dispatcher->createServerConnection(
std::move(socket), server_ssl_socket_factory.createTransportSocket(nullptr));
Expand Down