Unverified Commit c268b6c3 authored by Zachary Anderson's avatar Zachary Anderson Committed by GitHub

[flutter_tools] Collect more information in ios-handshake failure event (#50804)

parent 18984101
......@@ -120,13 +120,19 @@ class FallbackDiscovery {
} on Exception catch (err) {
_logger.printTrace(err.toString());
_logger.printTrace('Failed to connect directly, falling back to mDNS');
UsageEvent(_kEventName, 'failure').send();
UsageEvent(
_kEventName,
'failure',
label: err.toString(),
value: hostPort,
).send();
return null;
}
// Attempt to connect to the VM service 5 times.
int attempts = 0;
const int kDelaySeconds = 2;
Object firstException;
while (attempts < 5) {
try {
final VmService vmService = await _vmServiceConnectUri(assumedWsUri.toString());
......@@ -145,6 +151,7 @@ class FallbackDiscovery {
}
} on Exception catch (err) {
// No action, we might have failed to connect.
firstException ??= err;
_logger.printTrace(err.toString());
}
......@@ -156,7 +163,12 @@ class FallbackDiscovery {
attempts += 1;
}
_logger.printTrace('Failed to connect directly, falling back to mDNS');
UsageEvent(_kEventName, 'failure').send();
UsageEvent(
_kEventName,
'failure',
label: firstException?.toString() ?? 'Connection attempts exhausted',
value: hostPort,
).send();
return null;
}
}
......@@ -384,7 +384,12 @@ void main() {
debuggingOptions: DebuggingOptions.enabled(const BuildInfo(BuildMode.debug, null, treeShakeIcons: false)),
platformArgs: <String, dynamic>{},
);
verify(mockUsage.sendEvent('ios-handshake', 'failure')).called(1);
verify(mockUsage.sendEvent(
'ios-handshake',
'failure',
label: anyNamed('label'),
value: anyNamed('value'),
)).called(1);
verify(mockUsage.sendEvent('ios-handshake', 'mdns-failure')).called(1);
verify(mockUsage.sendEvent('ios-handshake', 'fallback-failure')).called(1);
expect(launchResult.started, isFalse);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment