Work toward fixing ONOS-1138: Batching topo event may cause event loss
Added another metric to the onos-app-metrics-topology application
to collect and display the number and rate of the Reasons for the
Topology Events.
Example:
onos> topology-events-metrics
...
Topology Graph Event Timestamp (ms from epoch)=1426699861509
Topology Graph Events count=6 rate(events/sec) mean=0.002315 m1=0.000000 m5=0.000004 m15=0.000378
Topology Graph Reasons Event Timestamp (ms from epoch)=1426699861509
Topology Graph Reasons Events count=9 rate(events/sec) mean=0.003472 m1=0.000000 m5=0.000005 m15=0.000567
The corresponding object names in the JSON output are:
topologyGraphReasonsEventRate
topologyGraphReasonsEventTimestamp
Change-Id: Ib1aeb83c38b3b72d0ae8a4f49bc1e14badc0199d
diff --git a/apps/metrics/topology/src/main/java/org/onosproject/metrics/topology/cli/TopologyEventsMetricsCommand.java b/apps/metrics/topology/src/main/java/org/onosproject/metrics/topology/cli/TopologyEventsMetricsCommand.java
index 274a14d..b87762a 100644
--- a/apps/metrics/topology/src/main/java/org/onosproject/metrics/topology/cli/TopologyEventsMetricsCommand.java
+++ b/apps/metrics/topology/src/main/java/org/onosproject/metrics/topology/cli/TopologyEventsMetricsCommand.java
@@ -60,12 +60,16 @@
service.topologyLinkEventMetric());
result = json(mapper, result, "topologyGraphEvent",
service.topologyGraphEventMetric());
+ result = json(mapper, result, "topologyGraphReasonsEvent",
+ service.topologyGraphReasonsEventMetric());
print("%s", result);
} else {
printEventMetric("Device", service.topologyDeviceEventMetric());
printEventMetric("Host", service.topologyHostEventMetric());
printEventMetric("Link", service.topologyLinkEventMetric());
printEventMetric("Graph", service.topologyGraphEventMetric());
+ printEventMetric("Graph Reasons",
+ service.topologyGraphReasonsEventMetric());
}
}