From cf892b36263532f8fcb45ec899f3474e1d3640a8 Mon Sep 17 00:00:00 2001 From: Wayne Zhang Date: Fri, 14 Sep 2018 17:21:23 -0700 Subject: [PATCH] Fix a bug of not setting global_word_count (#1974) * Fix a bug of not setting global_word_count Signed-off-by: Wayne Zhang * not to save global_dict_size Signed-off-by: Wayne Zhang --- src/istio/mixerclient/attribute_compressor.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/istio/mixerclient/attribute_compressor.cc b/src/istio/mixerclient/attribute_compressor.cc index c267504c5012..5b9f04bead02 100644 --- a/src/istio/mixerclient/attribute_compressor.cc +++ b/src/istio/mixerclient/attribute_compressor.cc @@ -126,9 +126,7 @@ void CompressByDict(const Attributes& attributes, MessageDictionary& dict, class BatchCompressorImpl : public BatchCompressor { public: BatchCompressorImpl(const GlobalDictionary& global_dict) - : dict_(global_dict) { - report_.set_global_word_count(global_dict.size()); - } + : global_dict_(global_dict), dict_(global_dict) {} void Add(const Attributes& attributes) override { CompressByDict(attributes, dict_, report_.add_attributes()); @@ -140,6 +138,7 @@ class BatchCompressorImpl : public BatchCompressor { for (const std::string& word : dict_.GetWords()) { report_.add_default_words(word); } + report_.set_global_word_count(global_dict_.size()); return report_; } @@ -149,6 +148,7 @@ class BatchCompressorImpl : public BatchCompressor { } private: + const GlobalDictionary& global_dict_; MessageDictionary dict_; ::istio::mixer::v1::ReportRequest report_; };