Skip to content

Commit

Permalink
Merge "Fix usage of DSSum attribute in Agent UVEs" into R3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Dec 4, 2016
2 parents 220a6b9 + 78a311a commit 80411f7
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 33 deletions.
9 changes: 6 additions & 3 deletions src/vnsw/agent/uve/interface.sandesh
Expand Up @@ -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;
}

Expand Down Expand Up @@ -80,8 +81,10 @@ struct UveVMInterfaceAgent {
/** @display_name:Virtual Machine Floating IP Statistics*/
17: optional list<VmFloatingIPStats> 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")
Expand Down Expand Up @@ -109,7 +112,7 @@ struct UveVMInterfaceAgent {
33: optional map<string, u64> raw_drop_stats (metric="agg", hidden="yes")
/** @display_name:Packet drop Statistics*/
34: optional map<string, u64> drop_stats (mstats="raw_drop_stats:DSNon0:", tags=".__key,virtual_network")
35: optional map<string, u64> drop_stats_1h (mstats="raw_drop_stats:DSSum:120")
35: optional map<string, u64> drop_stats_1h (mstats="raw_drop_stats:DSSum:3600")
}

/**
Expand Down
21 changes: 10 additions & 11 deletions src/vnsw/agent/uve/interface_uve_stats_table.cc
Expand Up @@ -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);
}
Expand Down
16 changes: 4 additions & 12 deletions src/vnsw/agent/uve/stats_manager.cc
Expand Up @@ -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) {
}

Expand All @@ -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()
Expand Down
6 changes: 1 addition & 5 deletions src/vnsw/agent/uve/stats_manager.h
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
13 changes: 11 additions & 2 deletions src/vnsw/agent/uve/vrouter.sandesh
Expand Up @@ -155,22 +155,29 @@ 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<string, u64> raw_drop_stats (metric="agg", hidden="yes")
/** @display_name:vhost Interface Packet drop Statistics*/
10: optional map<string, u64> 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<string, u64> drop_stats_1h (mstats="raw_drop_stats:DSSum:3600")
}

struct PhyIfStats {
2: u64 in_pkts;
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<string, u64> raw_drop_stats (metric="agg", hidden="yes")
/** @display_name:Physical Interface Packet drop Statistics*/
8: optional map<string, u64> drop_stats (mstats="raw_drop_stats:DSNon0:", tags=".__key")
9: optional map<string, u64> 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<string, u64> drop_stats_1h (mstats="raw_drop_stats:DSSum:3600")
}

struct PhyIfInfo {
Expand Down Expand Up @@ -254,10 +261,12 @@ struct VrouterStatsAgent { // Agent stats
40: optional list<u32> tcp_sport_bitmap;
41: optional list<u32> tcp_dport_bitmap;

/** List of drop reasons with packet count for each drop reason */
42: optional map<string, u64> raw_drop_stats (metric="agg", hidden="yes")
/** @display_name:Vrouter Packet drop Statistics*/
60: optional map<string, u64> drop_stats (mstats="raw_drop_stats:DSNon0:", tags=".__key")
61: optional map<string, u64> 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<string, u64> drop_stats_1h (mstats="raw_drop_stats:DSSum:3600")

43: optional double total_in_bandwidth_utilization;
44: optional double total_out_bandwidth_utilization;
Expand Down

0 comments on commit 80411f7

Please sign in to comment.