IP connectivity metrics: add new APF counters.
This patch adds a few missing counters to APF events:
- an actual lifetime duration to ApfProgramEvent.
- counters for total number of updates to ApfStatistics.
ApfProgramEvents are now recorded at program removal in order to
populate the actual lifetime of the program. ApfProgramEvents whose
actual lifetime was less than 1 second are filtered out.
Finally, instance fields of ApfProgramEvent and ApfStats classes are
made mutable to allow for simple record-like creation. This was not
possible when these classes were tagged @SystemApi.
Test: - manually verified output of $ dumpsys connmetrics list
- unit tests updated.
Bug: 34901696
Change-Id: I02694ebb9421ce1c2aa757fa6aa209d19a654dcd
This commit is contained in:
@@ -304,6 +304,7 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
ConnectivityMetricsEvent ev = describeIpEvent(
|
ConnectivityMetricsEvent ev = describeIpEvent(
|
||||||
aType(ApfProgramEvent.class),
|
aType(ApfProgramEvent.class),
|
||||||
aLong(200),
|
aLong(200),
|
||||||
|
aLong(18),
|
||||||
anInt(7),
|
anInt(7),
|
||||||
anInt(9),
|
anInt(9),
|
||||||
anInt(2048),
|
anInt(2048),
|
||||||
@@ -320,7 +321,7 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
" apf_program_event <",
|
" apf_program_event <",
|
||||||
" current_ras: 9",
|
" current_ras: 9",
|
||||||
" drop_multicast: true",
|
" drop_multicast: true",
|
||||||
" effective_lifetime: 0",
|
" effective_lifetime: 18",
|
||||||
" filtered_ras: 7",
|
" filtered_ras: 7",
|
||||||
" has_ipv4_addr: true",
|
" has_ipv4_addr: true",
|
||||||
" lifetime: 200",
|
" lifetime: 200",
|
||||||
@@ -343,6 +344,8 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
anInt(1),
|
anInt(1),
|
||||||
anInt(2),
|
anInt(2),
|
||||||
anInt(4),
|
anInt(4),
|
||||||
|
anInt(7),
|
||||||
|
anInt(3),
|
||||||
anInt(2048));
|
anInt(2048));
|
||||||
|
|
||||||
String want = joinLines(
|
String want = joinLines(
|
||||||
@@ -360,8 +363,8 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
|||||||
" max_program_size: 2048",
|
" max_program_size: 2048",
|
||||||
" parse_errors: 2",
|
" parse_errors: 2",
|
||||||
" program_updates: 4",
|
" program_updates: 4",
|
||||||
" program_updates_all: 0",
|
" program_updates_all: 7",
|
||||||
" program_updates_allowing_multicast: 0",
|
" program_updates_allowing_multicast: 3",
|
||||||
" received_ras: 10",
|
" received_ras: 10",
|
||||||
" zero_lifetime_ras: 1",
|
" zero_lifetime_ras: 1",
|
||||||
" >",
|
" >",
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ public class IpConnectivityMetricsTest extends TestCase {
|
|||||||
@SmallTest
|
@SmallTest
|
||||||
public void testRateLimiting() {
|
public void testRateLimiting() {
|
||||||
final IpConnectivityLog logger = new IpConnectivityLog(mService.impl);
|
final IpConnectivityLog logger = new IpConnectivityLog(mService.impl);
|
||||||
final ApfProgramEvent ev = new ApfProgramEvent(0, 0, 0, 0, 0);
|
final ApfProgramEvent ev = new ApfProgramEvent();
|
||||||
final long fakeTimestamp = 1;
|
final long fakeTimestamp = 1;
|
||||||
|
|
||||||
int attempt = 100; // More than burst quota, but less than buffer size.
|
int attempt = 100; // More than burst quota, but less than buffer size.
|
||||||
@@ -142,13 +142,24 @@ public class IpConnectivityMetricsTest extends TestCase {
|
|||||||
// TODO: instead of comparing textpb to textpb, parse textpb and compare proto to proto.
|
// TODO: instead of comparing textpb to textpb, parse textpb and compare proto to proto.
|
||||||
IpConnectivityLog logger = new IpConnectivityLog(mService.impl);
|
IpConnectivityLog logger = new IpConnectivityLog(mService.impl);
|
||||||
|
|
||||||
|
ApfStats apfStats = new ApfStats();
|
||||||
|
apfStats.durationMs = 45000;
|
||||||
|
apfStats.receivedRas = 10;
|
||||||
|
apfStats.matchingRas = 2;
|
||||||
|
apfStats.droppedRas = 2;
|
||||||
|
apfStats.parseErrors = 2;
|
||||||
|
apfStats.zeroLifetimeRas = 1;
|
||||||
|
apfStats.programUpdates = 4;
|
||||||
|
apfStats.programUpdatesAll = 7;
|
||||||
|
apfStats.programUpdatesAllowingMulticast = 3;
|
||||||
|
apfStats.maxProgramSize = 2048;
|
||||||
Parcelable[] events = {
|
Parcelable[] events = {
|
||||||
new IpReachabilityEvent("wlan0", IpReachabilityEvent.NUD_FAILED),
|
new IpReachabilityEvent("wlan0", IpReachabilityEvent.NUD_FAILED),
|
||||||
new DhcpClientEvent("wlan0", "SomeState", 192),
|
new DhcpClientEvent("wlan0", "SomeState", 192),
|
||||||
new DefaultNetworkEvent(102, new int[]{1,2,3}, 101, true, false),
|
new DefaultNetworkEvent(102, new int[]{1,2,3}, 101, true, false),
|
||||||
new IpManagerEvent("wlan0", IpManagerEvent.PROVISIONING_OK, 5678),
|
new IpManagerEvent("wlan0", IpManagerEvent.PROVISIONING_OK, 5678),
|
||||||
new ValidationProbeEvent(120, 40730, ValidationProbeEvent.PROBE_HTTP, 204),
|
new ValidationProbeEvent(120, 40730, ValidationProbeEvent.PROBE_HTTP, 204),
|
||||||
new ApfStats(45000, 10, 2, 2, 1, 2, 4, 2048),
|
apfStats,
|
||||||
new RaEvent(2000, 400, 300, -1, 1000, -1)
|
new RaEvent(2000, 400, 300, -1, 1000, -1)
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -240,8 +251,8 @@ public class IpConnectivityMetricsTest extends TestCase {
|
|||||||
" max_program_size: 2048",
|
" max_program_size: 2048",
|
||||||
" parse_errors: 2",
|
" parse_errors: 2",
|
||||||
" program_updates: 4",
|
" program_updates: 4",
|
||||||
" program_updates_all: 0",
|
" program_updates_all: 7",
|
||||||
" program_updates_allowing_multicast: 0",
|
" program_updates_allowing_multicast: 3",
|
||||||
" received_ras: 10",
|
" received_ras: 10",
|
||||||
" zero_lifetime_ras: 1",
|
" zero_lifetime_ras: 1",
|
||||||
" >",
|
" >",
|
||||||
|
|||||||
Reference in New Issue
Block a user