Skip to content

Commit

Permalink
Merge "Fix usage of DSSum attribute in Agent UVEs"
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 c05ef92 + 847459e commit 56f090a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 34 deletions.
5 changes: 3 additions & 2 deletions src/vnsw/agent/uve/interface.sandesh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct VmInterfaceStats {
3: u64 out_pkts;
/** Count of outgoing bytes */
4: u64 out_bytes;
/** Drop packet count */
5: u64 drop_pkts;
}

Expand Down Expand Up @@ -156,7 +157,7 @@ struct UveVMInterfaceAgent {
17: optional list<VmFloatingIPStats> fip_diff_stats (tags=".virtual_network,.ip_address")

/** Statistics of VMI. Contains aggregate statistics */
18: optional VmInterfaceStats raw_if_stats (hidden="yes")
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")
Expand Down Expand Up @@ -220,7 +221,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
15 changes: 11 additions & 4 deletions src/vnsw/agent/uve/vrouter.sandesh
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,14 @@ struct AgentIfStats {
6: i32 speed;
/** Duplexity of interface */
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")
}

/**
Expand All @@ -274,11 +278,14 @@ struct PhyIfStats {
4: u64 out_pkts;
/** Egress bytes count */
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")
}

/**
Expand Down Expand Up @@ -390,12 +397,12 @@ struct VrouterStatsAgent {
*/
41: optional list<u32> tcp_dport_bitmap;

/** List of drop reasons with count for each drop reason */
/** 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")
/** List of drop reasons with count for each drop reason for past 1 hour*/
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")

/** Ingress bandwidth of physical interface where the value is obtained by
* dividing the bandwidth computed in bps by speed of the physical interface
Expand Down

0 comments on commit 56f090a

Please sign in to comment.