From b59e4bd80f37e64840ef1eed0cb0c92edc2bbbeb Mon Sep 17 00:00:00 2001 From: Harvey Tuch Date: Thu, 19 Jul 2018 05:33:16 -0400 Subject: [PATCH] load_stats: fix for Google import. Risk level: Low Testing: OSS/Google unit/integration tests for LRS. Signed-off-by: Harvey Tuch --- source/common/upstream/load_stats_reporter.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/common/upstream/load_stats_reporter.cc b/source/common/upstream/load_stats_reporter.cc index 14067f0391ce..2bc986a3d590 100644 --- a/source/common/upstream/load_stats_reporter.cc +++ b/source/common/upstream/load_stats_reporter.cc @@ -120,8 +120,11 @@ void LoadStatsReporter::onReceiveMessage( void LoadStatsReporter::startLoadReportPeriod() { // Once a cluster is tracked, we don't want to reset its stats between reports // to avoid racing between request/response. - std::unordered_map - existing_clusters; + // TODO(htuch): They key here could be absl::string_view, but this causes + // problems due to referencing of temporaries in the below loop with Google's + // internal string type. Consider this optimization when the string types + // converge. + std::unordered_map existing_clusters; for (const std::string& cluster_name : message_->clusters()) { if (clusters_.count(cluster_name) > 0) { existing_clusters.emplace(cluster_name, clusters_[cluster_name]);