diff --git a/compiler/generate/t_cpp_generator.cc b/compiler/generate/t_cpp_generator.cc index e4ee5058..ef77d12a 100755 --- a/compiler/generate/t_cpp_generator.cc +++ b/compiler/generate/t_cpp_generator.cc @@ -2009,7 +2009,7 @@ void t_cpp_generator::generate_sandesh_definition(ofstream& out, assert((*f_iter)->get_name() == "data"); indent(out) << "static void Send(const " << type_name((*f_iter)->get_type()) << - "& data, std::string table = \"\");" << endl; + "& data, std::string table = \"\", uint64_t mono_usec=0);" << endl; indent(out) << "static void Send(const " << type_name((*f_iter)->get_type()) << "& cdata, SandeshUVE::SendType stype, uint32_t seqno," << @@ -2069,7 +2069,7 @@ void t_cpp_generator::generate_sandesh_definition(ofstream& out, " & _data, const map & _dsconf);" << endl; out << indent() << "static bool UpdateUVE(" << dtype << " & _data, " << dtype << - " & tdata);" << endl; + " & tdata, uint64_t mono_usec);" << endl; out << indent() << "bool LoadUVE(SendType stype, uint32_t cycle);" << endl; } @@ -3809,7 +3809,7 @@ void t_cpp_generator::generate_sandesh_updater(ofstream& out, indent(out) << "bool " << tsandesh->get_name() << "::UpdateUVE(" << dtype << " & _data, " << dtype << - " & tdata) {" << endl; + " & tdata, uint64_t mono_usec) {" << endl; indent_up(); @@ -3863,11 +3863,11 @@ void t_cpp_generator::generate_sandesh_updater(ofstream& out, if (c_iter->second.compattr_.empty()) { if (!c_iter->second.is_map_) { indent(out) << "tdata.__dsobj_" << *d_iter << - "->Update(_data.get_" << snm << "());" << endl; + "->Update(_data.get_" << snm << "(), mono_usec);" << endl; } else { indent(out) << "tdata.__dsobj_" << *d_iter << "->Update(_data.get_" << snm << "(), _delmap_" << - snm << ");" << endl; + snm << ", mono_usec);" << endl; } } else { string getexpr = string("get_") + c_iter->second.compattr_ + @@ -3878,7 +3878,7 @@ void t_cpp_generator::generate_sandesh_updater(ofstream& out, } if (!c_iter->second.is_map_) { indent(out) << "tdata.__dsobj_" << *d_iter << "->Update(_data.get_" << - snm << "()." << getexpr << ");" << endl; + snm << "()." << getexpr << ", mono_usec);" << endl; } else { indent(out) << "std::mapsecond.rawtype_ << "> temp_" << *d_iter << ";" << endl; @@ -3891,7 +3891,7 @@ void t_cpp_generator::generate_sandesh_updater(ofstream& out, indent_down(); indent(out) << "}" << endl; indent(out) << "tdata.__dsobj_" << *d_iter << "->Update(temp_" << - *d_iter << ", _delmap_" << snm << ");" << endl; + *d_iter << ", _delmap_" << snm << ", mono_usec);" << endl; indent(out) << "temp_" << *d_iter << ".clear();" << endl; } } @@ -4217,7 +4217,7 @@ void t_cpp_generator::generate_sandesh_uve_creator( indent(out) << "void " << sname << "::Send(const " << type_name((*f_iter)->get_type()) << - "& data, std::string table) {" << endl; + "& data, std::string table, uint64_t mono_usec) {" << endl; indent_up(); indent(out) << type_name((*f_iter)->get_type()) << @@ -4227,7 +4227,7 @@ void t_cpp_generator::generate_sandesh_uve_creator( indent(out) << "if (!table.empty()) cdata.table_ = table;" << endl; indent(out) << "if (uvemap" << sname << - ".UpdateUVE(cdata, msg_seqno)) {" << endl; + ".UpdateUVE(cdata, msg_seqno, mono_usec)) {" << endl; indent_up(); indent(out) << sname << " *snh = new " << sname << "(msg_seqno, cdata);" << endl; indent(out) << "snh->Dispatch();" << endl; diff --git a/library/common/sandesh_uve.sandesh b/library/common/sandesh_uve.sandesh index 8cafb4d7..a90111f9 100644 --- a/library/common/sandesh_uve.sandesh +++ b/library/common/sandesh_uve.sandesh @@ -242,18 +242,6 @@ struct SandeshSessionStats { 9: u64 num_write_ready_cb_error } -typedef u64 mcs_uint -struct mcs_uint_P_ { - 1: optional mcs_uint staging - 2: optional mcs_uint value -} - -typedef SandeshMessageStats SnhMsgStats -struct SnhMsgStats_P_ { - 1: optional SnhMsgStats staging - 2: optional SnhMsgStats value -} - struct ModuleClientState { 1: string name (key="ObjectGeneratorInfo") 2: optional bool deleted @@ -266,18 +254,18 @@ struct ModuleClientState { 10: optional map msg_type_agg (metric="agg", hidden="yes") /** @display_name:Sandesh Client Message Type Stats*/ - 11: optional map msg_type_diff (mstats="0-msg_type_agg:DSNon0:", tags=".__key") - 12: optional map msg_type_1h (mstats="60-msg_type_agg:DSSum:", hidden="yes") - 13: optional map msg_type_tx_10m (mstats="10-msg_type_agg.messages_sent:DSSum:") + 11: optional map msg_type_diff (mstats="msg_type_agg:DSNon0:", tags=".__key") + 12: optional map msg_type_1h (mstats="msg_type_agg:DSSum:3600", hidden="yes") + 13: optional map msg_type_tx_10m (mstats="msg_type_agg.messages_sent:DSSum:600") /** @display_name:Sandesh Client Message Stats*/ - 20: optional map tx_msg_agg (metric="agg", hidden="yes") - 21: optional map tx_msg_diff (mstats="0-tx_msg_agg:DSNon0:",tags=".__key") - 22: optional map tx_msg_1h (mstats="60-tx_msg_agg:DSSum:", hidden="yes") - 23: optional map tx_msg_10m (mstats="10-tx_msg_agg:DSSum:") + 20: optional map tx_msg_agg (metric="agg", hidden="yes") + 21: optional map tx_msg_diff (mstats="tx_msg_agg:DSNon0:",tags=".__key") + 22: optional map tx_msg_1h (mstats="tx_msg_agg:DSSum:3600", hidden="yes") + 23: optional map tx_msg_10m (mstats="tx_msg_agg:DSSum:600") 14: optional u64 max_sm_queue_count -} (period="60") +} uve sandesh SandeshModuleClientTrace { 1: ModuleClientState data diff --git a/library/cpp/derived_stats.h b/library/cpp/derived_stats.h index 15d48e6b..69f38796 100644 --- a/library/cpp/derived_stats.h +++ b/library/cpp/derived_stats.h @@ -25,6 +25,12 @@ class SandeshStructDeleteTrait; namespace contrail { namespace sandesh { +enum DSReturnType { + DSR_INVALID=0, + DSR_SKIP, + DSR_OK +}; + template std::map DerivedStatsAgg(const std::map & raw, std::map & agg, @@ -57,7 +63,8 @@ std::map DerivedStatsAgg(const std::map template class DSTT, typename ElemT, typename ResultT> void DerivedStatsMerge(const std::map & raw, std::map > > & dsm, - std::string annotation, const std::map &del) { + std::string annotation, const std::map &del, + uint64_t mono_usec) { std::map srcmap; typename std::map::const_iterator rit; @@ -92,7 +99,7 @@ void DerivedStatsMerge(const std::map & raw, dt++; dsm.erase(et); } else { - dt->second->Update(rit->second); + dt->second->Update(rit->second, mono_usec); ++dt; } } else { @@ -109,7 +116,7 @@ void DerivedStatsMerge(const std::map & raw, if ((mt->second == false) && (!dlt->second)) { assert(dsm.find(mt->first) == dsm.end()); dsm[mt->first] = boost::make_shared >(annotation); - dsm[mt->first]->Update((raw.find(mt->first))->second); + dsm[mt->first]->Update((raw.find(mt->first))->second, mono_usec); } } } @@ -146,7 +153,8 @@ class DerivedStatsIf { void FillResult(ResultT &res, bool& isset, bool force=false) const { isset = false; if (ds_) { - if (ds_->FillResult(res) || force) { + DSReturnType rt = ds_->FillResult(res); + if ((force && rt) || (!force && rt == DSR_OK)) { isset = true; } } @@ -158,7 +166,8 @@ class DerivedStatsIf { for (typename result_map::const_iterator dit = dsm_->begin(); dit != dsm_->end(); dit++) { ResultT res; - if (dit->second->FillResult(res) || force) { + DSReturnType rt = dit->second->FillResult(res); + if ((force && rt) || (!force && rt == DSR_OK)) { mres.insert(std::make_pair(dit->first, res)); } } @@ -169,7 +178,7 @@ class DerivedStatsIf { // This is the interface to feed in all updates to the raw stat // on which the derived stat will be based. - void Update(ElemT raw) { + void Update(ElemT raw, uint64_t mono_usec) { if (!ds_) { ds_ = boost::make_shared >(annotation_); if (is_agg_) { @@ -182,19 +191,20 @@ class DerivedStatsIf { agg_ = agg_ + diff_; } } - if (is_agg_) ds_->Update(diff_); - else ds_->Update(raw); + if (is_agg_) ds_->Update(diff_, mono_usec); + else ds_->Update(raw, mono_usec); } - void Update(const std::map & raw, const std::map &del) { + void Update(const std::map & raw, + const std::map &del, uint64_t mono_usec) { if (!dsm_) { dsm_ = boost::make_shared(); } if (is_agg_) { diffm_ = DerivedStatsAgg(raw, aggm_, del); - DerivedStatsMerge(diffm_, *dsm_, annotation_, del); + DerivedStatsMerge(diffm_, *dsm_, annotation_, del, mono_usec); } else { - DerivedStatsMerge(raw, *dsm_, annotation_, del); + DerivedStatsMerge(raw, *dsm_, annotation_, del, mono_usec); } } }; @@ -231,7 +241,7 @@ class DerivedStatsPeriodicIf { // This is the interface to feed in all updates to the raw stat // on which the derived stat will be based. - void Update(ElemT raw) { + void Update(ElemT raw, uint64_t mono_usec) { if (!ds_) { ds_ = boost::make_shared >(annotation_); } @@ -243,19 +253,22 @@ class DerivedStatsPeriodicIf { diff_ = raw - agg_; agg_ = agg_ + diff_; } - ds_->Update(diff_); - } else ds_->Update(raw); + ds_->Update(diff_, mono_usec); + } else ds_->Update(raw, mono_usec); init_ = true; } - void Update(const std::map & raw, const std::map &del) { + void Update(const std::map & raw, + const std::map &del, uint64_t mono_usec) { if (!dsm_) { dsm_ = boost::make_shared(); } if (is_agg_) { diffm_ = DerivedStatsAgg(raw, aggm_, del); - DerivedStatsMerge(diffm_, *dsm_, annotation_, del); - } else DerivedStatsMerge(raw, *dsm_, annotation_, del); + DerivedStatsMerge( + diffm_, *dsm_, annotation_, del, mono_usec); + } else DerivedStatsMerge( + raw, *dsm_, annotation_, del, mono_usec); init_ = true; } @@ -290,7 +303,8 @@ class DerivedStatsPeriodicIf { } if (ds_) { // Fill in current information - if (ds_->FillResult(res.staging) || force) { + DSReturnType rt = ds_->FillResult(res.staging); + if ((force && rt) || (!force && rt == DSR_OK)) { res.__isset.staging = true; isset = true; } @@ -343,12 +357,16 @@ class DerivedStatsPeriodicIf { typename std::map::iterator wit = mres.find(dit->first); if (wit != mres.end()) { - if (dit->second->FillResult(wit->second.staging) || force) { + DSReturnType rt = + dit->second->FillResult(wit->second.staging); + if ((force && rt) || (!force && rt == DSR_OK)) { wit->second.__isset.staging = true; } } else { ResultT res; - if (dit->second->FillResult(res.staging) || force) { + DSReturnType rt = + dit->second->FillResult(res.staging); + if ((force && rt) || (!force && rt == DSR_OK)) { res.__isset.staging = true; mres.insert(std::make_pair(dit->first, res)); } diff --git a/library/cpp/derived_stats_algo.h b/library/cpp/derived_stats_algo.h index 5d73520d..3c779eeb 100644 --- a/library/cpp/derived_stats_algo.h +++ b/library/cpp/derived_stats_algo.h @@ -16,64 +16,19 @@ #include #include #include +#include #include #include using std::vector; using std::map; +using std::pair; using std::make_pair; using std::string; namespace contrail { namespace sandesh { -template -class DSCategoryCount { -}; - -template<> -class DSCategoryCount { - public: - DSCategoryCount(const std::string &annotation) {} - - typedef map CatResT; - CatResT agg_counts_; - CatResT diff_counts_; - - bool FillResult(CategoryResult &res) const { - res.set_counters(diff_counts_); - return !diff_counts_.empty(); - } - - void Update(const CategoryResult& raw) { - diff_counts_.clear(); - for (CatResT::const_iterator it = raw.get_counters().begin(); - it != raw.get_counters().end(); it++) { - - // Is there anything to count? - if (!it->second) continue; - - CatResT::iterator mit = - agg_counts_.find(it->first); - - if (mit==agg_counts_.end()) { - // This is a new category - diff_counts_.insert(make_pair(it->first, it->second)); - agg_counts_.insert(make_pair(it->first, it->second)); - } else { - assert(it->second >= mit->second); - uint64_t diff = it->second - mit->second; - if (diff) { - // If the count for this category has changed, - // report the diff and update the aggregate - diff_counts_.insert(make_pair(it->first, diff)); - mit->second = it->second; - } - } - } - } -}; - // Interface for all Anomaly Detection algorithms // That can be plugged into the DSAnomaly DerivedStat template @@ -155,24 +110,23 @@ class DSAnomaly { impl_.reset(NULL); } - bool FillResult(AnomalyResT &res) const { - bool ret = true; + DSReturnType FillResult(AnomalyResT &res) const { + DSReturnType ret = DSR_OK; if (impl_) { - ret = impl_->FillResult(res); + if (!impl_->FillResult(res)) ret = DSR_SKIP; // We should have cleared impl_ if there was a parsing error // with the DSAnomaly config assert(error_.empty()); } - if (ret) { - res.set_samples(samples_); - res.set_algo(algo_); - res.set_config(config_); - if (!error_.empty()) res.set_error(error_); - } + + res.set_samples(samples_); + res.set_algo(algo_); + res.set_config(config_); + if (!error_.empty()) res.set_error(error_); return ret; } - void Update(const ElemT& raw) { + void Update(const ElemT& raw, uint64_t mono_usec) { samples_++; if (impl_) impl_->Update(raw); } @@ -188,7 +142,8 @@ template class DSEWM { public: DSEWM(const std::string &annotation): - mean_(0), variance_(0), samples_(0) { + mean_(0), variance_(0), + sigma_(0), stddev_(0), samples_(0) { alpha_ = (double) strtod(annotation.c_str(), NULL); if (alpha_ == 0) { error_ = std::string("Disabled"); @@ -208,18 +163,18 @@ class DSEWM { uint64_t samples_; std::string error_; - bool FillResult(EWMResT &res) const { + DSReturnType FillResult(EWMResT &res) const { res.set_samples(samples_); if (!error_.empty()) { res.set_error(error_); - return true; + return DSR_OK; } res.set_mean(mean_); res.set_stddev(stddev_); res.set_sigma(sigma_); - return true; + return DSR_OK; } - void Update(const ElemT& raw) { + void Update(const ElemT& raw, uint64_t mono_usec) { samples_++; if (!error_.empty()) return; variance_ = (1-alpha_)*(variance_ + (alpha_*pow(raw-mean_,2))); @@ -239,14 +194,14 @@ class DSChange { ElemT value_; ElemT prev_; - bool FillResult(NullResT &res) const { - assert(init_); + DSReturnType FillResult(NullResT &res) const { + if (!init_) return DSR_INVALID; res = value_; - if (prev_ == value_) return false; - else return true; + if (prev_ == value_) return DSR_SKIP; + else return DSR_OK; } - void Update(const ElemT& raw) { + void Update(const ElemT& raw, uint64_t mono_usec) { if (init_) prev_ = value_; value_ = raw; init_ = true; @@ -259,13 +214,13 @@ class DSNon0 { DSNon0(const std::string &annotation) {} ElemT value_; - bool FillResult(NullResT &res) const { + DSReturnType FillResult(NullResT &res) const { res = value_; - if (value_ == 0) return false; - return true; + if (value_ == 0) return DSR_SKIP; + else return DSR_OK; } - void Update(const ElemT& raw) { + void Update(const ElemT& raw, uint64_t mono_usec) { value_ = raw; } }; @@ -276,11 +231,11 @@ class DSNone { DSNone(const std::string &annotation) {} ElemT value_; - bool FillResult(NullResT &res) const { + DSReturnType FillResult(NullResT &res) const { res = value_; - return true; + return DSR_OK; } - void Update(const ElemT& raw) { + void Update(const ElemT& raw, uint64_t mono_usec) { value_ = raw; } }; @@ -292,85 +247,101 @@ class DSNull { ElemT value_; uint64_t samples_; - bool FillResult(NullResT &res) const { + DSReturnType FillResult(NullResT &res) const { res.set_samples(samples_); res.set_value(value_); - return true; + return DSR_OK; } - void Update(const ElemT& raw) { + void Update(const ElemT& raw, uint64_t mono_usec) { samples_++; value_ = raw; } }; -/* Deprecated: use metric="agg" on raw stat instead */ -template -class DSDiff { - public: - DSDiff(const std::string &annotation) : init_(false) {} - bool init_; - ElemT agg_; - ElemT diff_; - - bool FillResult(DiffResT &res) const { - ElemT empty; - if (!init_) return false; - if (diff_ == empty) return false; - res = diff_; - return true; - } - void Update(const ElemT& raw) { - if (!init_) { - diff_ = raw; - agg_ = raw; - } else { - diff_ = raw - agg_; - agg_ = agg_ + diff_; - } - init_ = true; - } -}; - template class DSSum { public: - DSSum(const std::string &annotation): samples_(0) { + DSSum(const std::string &annotation): samples_(0), shifter_(0), + start_tbin_(0), last_tbin_(0) { + if (annotation.empty()) { - history_count_ = 0; + range_usecs_ = 0; } else { - history_count_ = (uint64_t) strtoul(annotation.c_str(), NULL, 10); + range_usecs_ = ((uint64_t) strtoul(annotation.c_str(), NULL, 10)) * 1000000; + // We want each time bucket to represent between + // 1/128th and 1/256th of the entire range + // This ensures that there will never be more than 256 buckets + while ((1 << (shifter_ + 8)) < range_usecs_) shifter_++; } } uint64_t samples_; SumResT value_; - SumResT prev_; - vector history_buf_; - uint64_t history_count_; - - virtual bool FillResult(SumResT &res) const { - if (!samples_) return false; + map > history_buf_; + uint64_t range_usecs_; + uint8_t shifter_; + uint64_t start_tbin_; + uint64_t last_tbin_; + + virtual DSReturnType FillResult(SumResT &res) const { + static SumResT empty_val; + if (!samples_) { + res = empty_val; + return DSR_INVALID; + } + if (range_usecs_) { + // At least one time-range's worth of samples must be seen + // before we can report a SUM + uint64_t end_range = + ((start_tbin_ + range_usecs_) >> shifter_) << shifter_; + if (end_range > last_tbin_) { + res = empty_val; + return DSR_INVALID; + } else { + } + } res = value_; - if (history_count_ && (value_ == prev_)) return false; - else return true; + return DSR_OK; } - virtual void Update(const ElemT& raw) { + virtual void Purge(uint64_t mono_usec) { + + for (typename map >::iterator it = + history_buf_.begin(); it!= history_buf_.end(); ) { + uint64_t end_range = ((it->first + range_usecs_) >> shifter_) << shifter_; + if (end_range <= mono_usec) { + value_ = value_ - it->second.second; + samples_ = samples_ - it->second.first; + history_buf_.erase(it++); + } else { + ++it; + } + } + } + + virtual void Update(const ElemT& raw, uint64_t mono_usec) { if (!samples_) { value_ = raw; } else { - prev_ = value_; value_ = value_ + raw; } - if (history_count_) { - // if 'history_count_' is non-0, we need to aggregate only - // the last 'history_count_' elements - if (samples_ >= history_count_) { - // We must substract the oldest entry, if it exists - value_ = value_ - history_buf_[samples_ % history_count_]; - // Now record the latest update, so we can subtract when needed - history_buf_[samples_ % history_count_] = raw; + if (range_usecs_) { + // if 'range_usecs_' is non-0, we need to aggregate only + // the last 'range_usecs_' worth of elements + uint64_t tbin = (mono_usec >> shifter_) << shifter_; + if (!start_tbin_) start_tbin_ = tbin; + last_tbin_ = tbin; + + // Subtract old entries, if there are any + Purge(tbin); + + // Record the new update, so we can subtract when needed + typename map >::iterator ut = + history_buf_.find(tbin); + if (ut == history_buf_.end()) { + history_buf_[tbin] = make_pair(1,raw); } else { - history_buf_.push_back(raw); + ut->second.second = ut->second.second + raw; + ut->second.first++; } } samples_++; @@ -382,17 +353,14 @@ class DSAvg : public DSSum { public: DSAvg(const std::string &annotation): DSSum(annotation) {} - virtual bool FillResult(AvgResT &res) const { - if (!DSSum::samples_) return false; - if (DSSum::history_count_) { - uint64_t div = - ((DSSum::samples_ >=DSSum::history_count_) ? - DSSum::history_count_ : DSSum::samples_); - res = DSSum::value_ / div; + virtual DSReturnType FillResult(AvgResT &res) const { + AvgResT sres; + if (DSSum::FillResult(sres) == DSR_OK) { + res = sres / DSSum::samples_; + return DSR_OK; } else { - res = DSSum::value_ / DSSum::samples_; + return DSR_INVALID; } - return true; } }; diff --git a/library/cpp/sandesh_uve.h b/library/cpp/sandesh_uve.h index c5c8e93b..523e3893 100644 --- a/library/cpp/sandesh_uve.h +++ b/library/cpp/sandesh_uve.h @@ -133,13 +133,14 @@ class SandeshUVEPerTypeMapImpl : public SandeshUVEPerTypeMap { // This function is called whenever a SandeshUVE is sent from // the generator to the collector. // It updates the cache. - bool UpdateUVE(U& data, uint32_t seqnum) { + bool UpdateUVE(U& data, uint32_t seqnum, uint64_t mono_usec) { bool send = false; tbb::mutex::scoped_lock lock; const std::string &table = data.table_; assert(!table.empty()); const std::string &s = data.get_name(); - + if (!mono_usec) mono_usec = ClockMonotonicUsec(); + // pickup DS Config lock.acquire(uve_mutex_); std::map dsconf = dsconf_; @@ -165,10 +166,10 @@ class SandeshUVEPerTypeMapImpl : public SandeshUVEPerTypeMap { if (imapentry == a->second.end()) { std::auto_ptr ume(new UVEMapEntry(data.table_, seqnum)); T::_InitDerivedStats(ume->data, dsconf); - send = T::UpdateUVE(data, ume->data); + send = T::UpdateUVE(data, ume->data, mono_usec); imapentry = a->second.insert(table, ume).first; } else { - send = T::UpdateUVE(data, imapentry->second->data); + send = T::UpdateUVE(data, imapentry->second->data, mono_usec); imapentry->second->seqno = seqnum; } if (data.get_deleted()) { diff --git a/library/cpp/test/sandesh_message_test.cc b/library/cpp/test/sandesh_message_test.cc index 0fdabf67..40d568d5 100644 --- a/library/cpp/test/sandesh_message_test.cc +++ b/library/cpp/test/sandesh_message_test.cc @@ -796,7 +796,7 @@ class SandeshUVEAlarmTest : public ::testing::Test { EXPECT_STREQ(mm["sum_tsm"].c_str(), "j217j327"); EXPECT_STREQ(mm["avg_x"].c_str(), -"98"); +""); EXPECT_STREQ(mm["avh_jx"].c_str(), ""); EXPECT_STREQ(mm["avg_jx"].c_str(), @@ -836,7 +836,7 @@ class SandeshUVEAlarmTest : public ::testing::Test { EXPECT_STREQ(mm["name"].c_str(), "uve1"); EXPECT_STREQ(mm["avg_x"].c_str(), -"9498"); +"94"); EXPECT_STREQ(mm["x"].c_str(), ""); EXPECT_STREQ(mm["tsm"].c_str(), @@ -844,7 +844,7 @@ class SandeshUVEAlarmTest : public ::testing::Test { EXPECT_STREQ(mm["sum_tsm"].c_str(), "j217j327"); EXPECT_STREQ(mm["avh_jx"].c_str(), -""); +""); EXPECT_STREQ(mm["avi_jx"].c_str(), "75"); EXPECT_STREQ(mm["avg_jx"].c_str(), @@ -1009,7 +1009,7 @@ TEST_F(SandeshUVEAlarmTest, UVEAlarm) { uve_data2.set_jx(75); - SandeshPeriodicTest::Send(uve_data2); + SandeshPeriodicTest::Send(uve_data2, "ObjectGeneratorInfo", 2000000); } { @@ -1017,7 +1017,7 @@ TEST_F(SandeshUVEAlarmTest, UVEAlarm) { uve_data10.set_name("uve1"); uve_data10.set_x(98); - SandeshPeriodicTest::Send(uve_data10); + SandeshPeriodicTest::Send(uve_data10, "ObjectGeneratorInfo", 3000000); } // verify SyncAllMaps() sends all UVEs/Alarms from the cache @@ -1111,28 +1111,28 @@ TEST_F(SandeshUVEAlarmTest, UVEAlarm) { SandeshPeriodicData uve_data2; uve_data2.set_name("uve1"); uve_data2.set_x(11); - SandeshPeriodicTest::Send(uve_data2); + SandeshPeriodicTest::Send(uve_data2, "ObjectGeneratorInfo", 4000000); } { SandeshPeriodicData uve_data2; uve_data2.set_name("uve1"); uve_data2.set_x(95); - SandeshPeriodicTest::Send(uve_data2); + SandeshPeriodicTest::Send(uve_data2, "ObjectGeneratorInfo", 5000000); } { SandeshPeriodicData uve_data2; uve_data2.set_name("uve1"); uve_data2.set_x(90); - SandeshPeriodicTest::Send(uve_data2); + SandeshPeriodicTest::Send(uve_data2, "ObjectGeneratorInfo", 6000000); } { SandeshPeriodicData uve_data2; uve_data2.set_name("uve1"); uve_data2.set_x(97); - SandeshPeriodicTest::Send(uve_data2); + SandeshPeriodicTest::Send(uve_data2, "ObjectGeneratorInfo", 7000000); } diff --git a/library/cpp/test/sandesh_message_test.sandesh b/library/cpp/test/sandesh_message_test.sandesh index 03a20207..3a9b605e 100644 --- a/library/cpp/test/sandesh_message_test.sandesh +++ b/library/cpp/test/sandesh_message_test.sandesh @@ -110,7 +110,7 @@ struct SandeshPeriodicData { 8: optional i32 jx // This DS is hidden-periodic - 9: optional int_P_ avh_jx (stats="jx:DSAvg:3", hidden="yes") + 9: optional int_P_ avh_jx (stats="jx:DSAvg", hidden="yes") // Periodic DS, with period of 2. 10: optional int_P_ avg_jx (stats="2-jx:DSNone:3")