diff --git a/src/vnsw/agent/uve/interface.sandesh b/src/vnsw/agent/uve/interface.sandesh index 8e130a4a8ca..1e3cf5760d7 100644 --- a/src/vnsw/agent/uve/interface.sandesh +++ b/src/vnsw/agent/uve/interface.sandesh @@ -38,6 +38,7 @@ struct VmInterfaceStats { 2: u64 in_bytes; 3: u64 out_pkts; 4: u64 out_bytes; + /** Drop packet count */ 5: u64 drop_pkts; } @@ -80,8 +81,10 @@ struct UveVMInterfaceAgent { /** @display_name:Virtual Machine Floating IP Statistics*/ 17: optional list fip_diff_stats (tags=".virtual_network,.ip_address") - 18: optional VmInterfaceStats raw_if_stats (hidden="yes") - /** @display_name:Virtual Machine Interface Statistics*/ + /** Statistics of VMI. Contains aggregate statistics */ + 18: optional VmInterfaceStats raw_if_stats (metric="agg", hidden="yes") + /** Contains statistics of VMI since previous send */ + /** @display_name:Virtual Machine Interface Statistics */ 30: optional VmInterfaceStats if_stats (stats="raw_if_stats:DSNon0:", tags="vm_name,vm_uuid") 31: optional derived_stats_results.AnomalyResult if_in_pkts_ewm (stats="raw_if_stats.in_pkts:DSAnomaly:EWM:0.1") @@ -109,7 +112,7 @@ struct UveVMInterfaceAgent { 33: optional map raw_drop_stats (metric="agg", hidden="yes") /** @display_name:Packet drop Statistics*/ 34: optional map drop_stats (mstats="raw_drop_stats:DSNon0:", tags=".__key,virtual_network") - 35: optional map drop_stats_1h (mstats="raw_drop_stats:DSSum:120") + 35: optional map drop_stats_1h (mstats="raw_drop_stats:DSSum:3600") } /** diff --git a/src/vnsw/agent/uve/interface_uve_stats_table.cc b/src/vnsw/agent/uve/interface_uve_stats_table.cc index 3a6bd8eb144..df1b1d9dd87 100644 --- a/src/vnsw/agent/uve/interface_uve_stats_table.cc +++ b/src/vnsw/agent/uve/interface_uve_stats_table.cc @@ -42,19 +42,18 @@ bool InterfaceUveStatsTable::FrameInterfaceStatsMsg(UveInterfaceEntry* entry, agent_uve->stats_manager()->BuildDropStats(s->drop_stats, ds); uve->set_raw_drop_stats(ds); - /* Only diff since previous send needs to be sent as we export - * stats via StatsOracle infra provided by analytics module */ - uint64_t in_b, in_p, out_b, out_p, drop_p; - s->GetDiffStats(&in_b, &in_p, &out_b, &out_p, &drop_p); - - if_stats.set_in_pkts(in_p); - if_stats.set_in_bytes(in_b); - if_stats.set_out_pkts(out_p); - if_stats.set_out_bytes(out_b); - if_stats.set_drop_pkts(drop_p); + /* Send aggregate interface stats always */ + if_stats.set_in_pkts(s->in_pkts); + if_stats.set_in_bytes(s->in_bytes); + if_stats.set_out_pkts(s->out_pkts); + if_stats.set_out_bytes(s->out_bytes); + if_stats.set_drop_pkts(s->drop_pkts); uve->set_raw_if_stats(if_stats); - if ((in_b != 0) || (in_p != 0) || (out_b != 0) || (out_p != 0)) { + /* Compute bandwidth only if there is change in statistics */ + uint64_t in_b, out_b; + s->GetDiffStats(&in_b, &out_b); + if ((in_b != 0) || (out_b != 0)) { in_band = GetVmPortBandwidth(s, true); out_band = GetVmPortBandwidth(s, false); } diff --git a/src/vnsw/agent/uve/stats_manager.cc b/src/vnsw/agent/uve/stats_manager.cc index f615614ae09..95353e27095 100644 --- a/src/vnsw/agent/uve/stats_manager.cc +++ b/src/vnsw/agent/uve/stats_manager.cc @@ -203,9 +203,8 @@ void StatsManager::Shutdown(void) { StatsManager::InterfaceStats::InterfaceStats() : name(""), speed(0), duplexity(0), in_pkts(0), in_bytes(0), - out_pkts(0), out_bytes(0), drop_pkts(0), prev_in_bytes(0), - prev_out_bytes(0), prev_in_pkts(0), prev_out_pkts(0), prev_drop_pkts(0), - prev_5min_in_bytes(0), prev_5min_out_bytes(0), stats_time(0), flow_info(), + out_pkts(0), out_bytes(0), drop_pkts(0), prev_in_bytes(0), prev_out_bytes(0) + , prev_5min_in_bytes(0), prev_5min_out_bytes(0), stats_time(0), flow_info(), added(), deleted(), drop_stats_received(false) { } @@ -221,20 +220,13 @@ void StatsManager::InterfaceStats::UpdateStats void StatsManager::InterfaceStats::UpdatePrevStats() { prev_in_bytes = in_bytes; - prev_in_pkts = in_pkts; prev_out_bytes = out_bytes; - prev_out_pkts = out_pkts; - prev_drop_pkts = drop_pkts; } -void StatsManager::InterfaceStats::GetDiffStats - (uint64_t *in_b, uint64_t *in_p, uint64_t *out_b, uint64_t *out_p, - uint64_t *drop_p) { +void StatsManager::InterfaceStats::GetDiffStats(uint64_t *in_b, + uint64_t *out_b) const { *in_b = in_bytes - prev_in_bytes; - *in_p = in_pkts - prev_in_pkts; *out_b = out_bytes - prev_out_bytes; - *out_p = out_pkts - prev_out_pkts; - *drop_p = drop_pkts - prev_drop_pkts; } StatsManager::VrfStats::VrfStats() diff --git a/src/vnsw/agent/uve/stats_manager.h b/src/vnsw/agent/uve/stats_manager.h index bce3d85334f..e773dca3ae6 100644 --- a/src/vnsw/agent/uve/stats_manager.h +++ b/src/vnsw/agent/uve/stats_manager.h @@ -37,8 +37,7 @@ class StatsManager { void UpdateStats(uint64_t in_b, uint64_t in_p, uint64_t out_b, uint64_t out_p, uint64_t drop_p); void UpdatePrevStats(); - void GetDiffStats(uint64_t *in_b, uint64_t *in_p, uint64_t *out_b, - uint64_t *out_p, uint64_t *drop_p); + void GetDiffStats(uint64_t *in_b, uint64_t *out_b) const; std::string name; int32_t speed; @@ -50,9 +49,6 @@ class StatsManager { uint64_t drop_pkts; uint64_t prev_in_bytes; uint64_t prev_out_bytes; - uint64_t prev_in_pkts; /* Required for sending diff stats */ - uint64_t prev_out_pkts; /* Required for sending diff stats */ - uint64_t prev_drop_pkts; /* Required for sending diff stats */ uint64_t prev_5min_in_bytes; uint64_t prev_5min_out_bytes; uint64_t stats_time; diff --git a/src/vnsw/agent/uve/vrouter.sandesh b/src/vnsw/agent/uve/vrouter.sandesh index c01f2dd6a9f..3ba167d9979 100644 --- a/src/vnsw/agent/uve/vrouter.sandesh +++ b/src/vnsw/agent/uve/vrouter.sandesh @@ -155,10 +155,14 @@ struct AgentIfStats { 5: u64 out_bytes; 6: i32 speed; 7: i32 duplexity; + /** Drop packet count */ 8: u64 drop_pkts; + /** List of drop reasons with packet count for each drop reason */ 9: optional map raw_drop_stats (metric="agg", hidden="yes") /** @display_name:vhost Interface Packet drop Statistics*/ 10: optional map drop_stats (mstats="raw_drop_stats:DSNon0:", tags=".__key") + /** List of drop reasons with packet count for each drop reason for past 1 hour*/ + 11: optional map drop_stats_1h (mstats="raw_drop_stats:DSSum:3600") } struct PhyIfStats { @@ -166,11 +170,14 @@ struct PhyIfStats { 3: u64 in_bytes; 4: u64 out_pkts; 5: u64 out_bytes; + /** Drop packet count */ 6: u64 drop_pkts; + /** List of drop reasons with packet count for each drop reason */ 7: optional map raw_drop_stats (metric="agg", hidden="yes") /** @display_name:Physical Interface Packet drop Statistics*/ 8: optional map drop_stats (mstats="raw_drop_stats:DSNon0:", tags=".__key") - 9: optional map drop_stats_1h (mstats="raw_drop_stats:DSSum:120") + /** List of drop reasons with packet count for each drop reason for past 1 hour*/ + 9: optional map drop_stats_1h (mstats="raw_drop_stats:DSSum:3600") } struct PhyIfInfo { @@ -254,10 +261,12 @@ struct VrouterStatsAgent { // Agent stats 40: optional list tcp_sport_bitmap; 41: optional list tcp_dport_bitmap; + /** List of drop reasons with packet count for each drop reason */ 42: optional map raw_drop_stats (metric="agg", hidden="yes") /** @display_name:Vrouter Packet drop Statistics*/ 60: optional map drop_stats (mstats="raw_drop_stats:DSNon0:", tags=".__key") - 61: optional map drop_stats_1h (mstats="raw_drop_stats:DSSum:120") + /** List of drop reasons with packet count for each drop reason for past 1 hour*/ + 61: optional map drop_stats_1h (mstats="raw_drop_stats:DSSum:3600") 43: optional double total_in_bandwidth_utilization; 44: optional double total_out_bandwidth_utilization;