Skip to content

Commit

Permalink
Merge "Add sm_queue_count, sm_drop_level, db_queue_count, db_drop_lev…
Browse files Browse the repository at this point in the history
…el, num_generators to ShowCollectorServerResp introspect. Partial-Bug: #1469919"
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jul 4, 2015
2 parents ad4cea8 + 9000e29 commit 0ff8231
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 10 deletions.
25 changes: 21 additions & 4 deletions src/analytics/collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ void Collector::GetGeneratorUVEInfo(vector<ModuleServerState> &genlist) {
}
}

void Collector::GetGeneratorSummaryInfo(vector<GeneratorSummaryInfo> &genlist) {
genlist.clear();
void Collector::GetGeneratorSummaryInfo(vector<GeneratorSummaryInfo> *genlist) {
genlist->clear();
tbb::mutex::scoped_lock lock(gen_map_mutex_);
for (GeneratorMap::const_iterator gm_it = gen_map_.begin();
gm_it != gen_map_.end(); gm_it++) {
Expand All @@ -465,7 +465,23 @@ void Collector::GetGeneratorSummaryInfo(vector<GeneratorSummaryInfo> &genlist) {
gsinfo.set_instance_id(gm_it->first.get<2>());
gsinfo.set_node_type(gm_it->first.get<3>());
gsinfo.set_state(gen->State());
genlist.push_back(gsinfo);
uint64_t sm_queue_count;
if (gen->GetSandeshStateMachineQueueCount(sm_queue_count)) {
gsinfo.set_sm_queue_count(sm_queue_count);
}
std::string sm_drop_level;
if (gen->GetSandeshStateMachineDropLevel(sm_drop_level)) {
gsinfo.set_sm_drop_level(sm_drop_level);
}
uint64_t db_queue_count;
uint64_t db_enqueues;
std::string db_drop_level;
if (gen->GetDbStats(&db_queue_count, &db_enqueues,
&db_drop_level, NULL)) {
gsinfo.set_db_queue_count(db_queue_count);
gsinfo.set_db_drop_level(db_drop_level);
}
genlist->push_back(gsinfo);
}
}
}
Expand Down Expand Up @@ -603,8 +619,9 @@ class ShowCollectorServerHandler {
resp->set_stats(vsc->Analytics()->GetCollector()->GetStats());
// SandeshGenerator summary info
vector<GeneratorSummaryInfo> generators;
vsc->Analytics()->GetCollector()->GetGeneratorSummaryInfo(generators);
vsc->Analytics()->GetCollector()->GetGeneratorSummaryInfo(&generators);
resp->set_generators(generators);
resp->set_num_generators(generators.size());
// Send the response
resp->set_context(req->context());
resp->Response();
Expand Down
2 changes: 1 addition & 1 deletion src/analytics/collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Collector : public SandeshServer {
virtual bool ReceiveSandeshCtrlMsg(SandeshStateMachine *state_machine,
SandeshSession *session, const Sandesh *sandesh);

void GetGeneratorSummaryInfo(std::vector<GeneratorSummaryInfo> &genlist);
void GetGeneratorSummaryInfo(std::vector<GeneratorSummaryInfo> *genlist);
void GetGeneratorUVEInfo(std::vector<ModuleServerState> &genlist);
bool SendRemote(const std::string& destination,
const std::string &dec_sandesh);
Expand Down
11 changes: 8 additions & 3 deletions src/analytics/collector_uve.sandesh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ struct GeneratorSummaryInfo {
2: string module_id
3: string state
4: string instance_id
5: string node_type
5: string node_type
6: u64 sm_queue_count
7: u64 db_queue_count
8: string sm_drop_level
9: string db_drop_level
}

struct CollectorStats {
Expand Down Expand Up @@ -122,8 +126,9 @@ request sandesh ShowCollectorServerReq {
response sandesh ShowCollectorServerResp {
1: io.SocketIOStats rx_socket_stats
2: io.SocketIOStats tx_socket_stats
3: list<GeneratorSummaryInfo> generators
4: CollectorStats stats
3: u64 num_generators
4: list<GeneratorSummaryInfo> generators
5: CollectorStats stats
}

// This struct is part of the CollectorInfo UVE. (key is hostname on which this
Expand Down
2 changes: 1 addition & 1 deletion src/analytics/db_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ void DbHandler::ResetDbQueueWaterMarkInfo() {
void DbHandler::GetSandeshStats(std::string *drop_level,
std::vector<SandeshStats> *vdropmstats) const {
*drop_level = Sandesh::LevelToString(drop_level_);
{
if (vdropmstats) {
tbb::mutex::scoped_lock lock(smutex_);
dropped_msg_stats_.Get(*vdropmstats);
}
Expand Down
2 changes: 1 addition & 1 deletion src/analytics/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool CollectorSummaryLogger(Collector *collector, const string & hostname,
}

std::vector<GeneratorSummaryInfo> infos;
collector->GetGeneratorSummaryInfo(infos);
collector->GetGeneratorSummaryInfo(&infos);

state.set_generator_infos(infos);

Expand Down

0 comments on commit 0ff8231

Please sign in to comment.