Unverified Commit 09f4a697 authored by Kevin Chisholm's avatar Kevin Chisholm Committed by GitHub
Browse files

Revert "Remove references to Observatory (#118577)" (#120933)

This reverts commit 2df140f4.
parent 865422da
No related merge requests found
Showing with 76 additions and 78 deletions
+76 -78
......@@ -41,7 +41,7 @@ assignees: ''
can have an intuitive understanding of what happened. Don’t use
"adb screenrecord", as that affects the performance of the profile run.
5. Open Flutter DevTools and save a timeline trace of the performance issue
5. Open Observatory and save a timeline trace of the performance issue
so we know which functions might be causing it. See "How to Collect
and Read Timeline Traces" on this blog post:
https://medium.com/flutter/profiling-flutter-applications-using-the-timeline-a1a434964af3#a499
......
......@@ -202,7 +202,7 @@ Future<TaskResult> runTask(
.transform<String>(const LineSplitter())
.listen((String line) {
if (!uri.isCompleted) {
final Uri? serviceUri = parseServiceUri(line, prefix: RegExp('The Dart VM service is listening on '));
final Uri? serviceUri = parseServiceUri(line, prefix: RegExp('(Observatory|The Dart VM service is) listening on '));
if (serviceUri != null) {
uri.complete(serviceUri);
}
......
......@@ -664,14 +664,14 @@ Future<void> runAndCaptureAsyncStacks(Future<void> Function() callback) {
bool canRun(String path) => _processManager.canRun(path);
final RegExp _obsRegExp =
RegExp('A Dart VM Service .* is available at: ');
RegExp('An Observatory debugger .* is available at: ');
final RegExp _obsPortRegExp = RegExp(r'(\S+:(\d+)/\S*)$');
final RegExp _obsUriRegExp = RegExp(r'((http|//)[a-zA-Z0-9:/=_\-\.\[\]]+)');
/// Tries to extract a port from the string.
///
/// The `prefix`, if specified, is a regular expression pattern and must not contain groups.
/// `prefix` defaults to the RegExp: `A Dart VM Service .* is available at: `.
/// `prefix` defaults to the RegExp: `An Observatory debugger .* is available at: `.
int? parseServicePort(String line, {
Pattern? prefix,
}) {
......@@ -689,7 +689,7 @@ int? parseServicePort(String line, {
/// Tries to extract a URL from the string.
///
/// The `prefix`, if specified, is a regular expression pattern and must not contain groups.
/// `prefix` defaults to the RegExp: `A Dart VM Service .* is available at: `.
/// `prefix` defaults to the RegExp: `An Observatory debugger .* is available at: `.
Uri? parseServiceUri(String line, {
Pattern? prefix,
}) {
......
......@@ -1184,11 +1184,11 @@ class PerfTestWithSkSL extends PerfTest {
await _generateSkSL();
// Build the app with SkSL artifacts and run that app
final String vmServiceUri = await _runApp(skslPath: _skslJsonFileName);
final String observatoryUri = await _runApp(skslPath: _skslJsonFileName);
// Attach to the running app and run the final driver test to get metrics.
final TaskResult result = await internalRun(
existingApp: vmServiceUri,
existingApp: observatoryUri,
);
_runProcess.kill();
......@@ -1207,8 +1207,8 @@ class PerfTestWithSkSL extends PerfTest {
// `--write-sksl-on-exit` option doesn't seem to be compatible with
// `flutter drive --existing-app` as it will complain web socket connection
// issues.
final String vmServiceUri = await _runApp(cacheSkSL: true);
await super.internalRun(cacheSkSL: true, existingApp: vmServiceUri);
final String observatoryUri = await _runApp(cacheSkSL: true);
await super.internalRun(cacheSkSL: true, existingApp: observatoryUri);
_runProcess.kill();
await _runProcess.exitCode;
......
......@@ -19,7 +19,7 @@ void main() {
group('parse service', () {
const String badOutput = 'No uri here';
const String sampleOutput = 'A Dart VM Service on '
const String sampleOutput = 'An Observatory debugger and profiler on '
'Pixel 3 XL is available at: http://127.0.0.1:9090/LpjUpsdEjqI=/';
test('uri', () {
......
......@@ -138,7 +138,7 @@ abstract class BindingBase {
/// First calls [initInstances] to have bindings initialize their
/// instance pointers and other state, then calls
/// [initServiceExtensions] to have bindings initialize their
/// VM service extensions, if any.
/// observatory service extensions, if any.
BindingBase() {
developer.Timeline.startSync('Framework initialization');
assert(() {
......
......@@ -69,10 +69,10 @@ abstract class ShaderWarmUp {
///
/// To decide which draw operations to be added to your custom warm up
/// process, consider capturing an skp using `flutter screenshot
/// --vm-service-uri=<uri> --type=skia` and analyzing it with
/// --observatory-uri=<uri> --type=skia` and analyzing it with
/// <https://debugger.skia.org/>. Alternatively, one may run the app with
/// `flutter run --trace-skia` and then examine the raster thread in the
/// Flutter DevTools timeline to see which Skia draw operations are commonly used,
/// observatory timeline to see which Skia draw operations are commonly used,
/// and which shader compilations are causing jank.
@protected
Future<void> warmUpOnCanvas(ui.Canvas canvas);
......
......@@ -1174,7 +1174,7 @@ class WidgetsApp extends StatefulWidget {
/// If true, forces the performance overlay to be visible in all instances.
///
/// Used by the `showPerformanceOverlay` VM service extension.
/// Used by the `showPerformanceOverlay` observatory extension.
static bool showPerformanceOverlayOverride = false;
/// If true, forces the widget inspector to be visible.
......@@ -1184,12 +1184,12 @@ class WidgetsApp extends StatefulWidget {
/// The inspector allows you to select a location on your device or emulator
/// and view what widgets and render objects associated with it. An outline of
/// the selected widget and some summary information is shown on device and
/// more detailed information is shown in the IDE or DevTools.
/// more detailed information is shown in the IDE or Observatory.
static bool debugShowWidgetInspectorOverride = false;
/// If false, prevents the debug banner from being visible.
///
/// Used by the `debugAllowBanner` VM service extension.
/// Used by the `debugAllowBanner` observatory extension.
///
/// This is how `flutter run` turns off the banner when you take a screen shot
/// with "s".
......
......@@ -33,8 +33,8 @@ import 'table.dart';
/// Combined with [debugPrintScheduleBuildForStacks], this lets you watch a
/// widget's dirty/clean lifecycle.
///
/// To get similar information but showing it on the timeline available from
/// Flutter DevTools rather than getting it in the console (where it can be
/// To get similar information but showing it on the timeline available from the
/// Observatory rather than getting it in the console (where it can be
/// overwhelming), consider [debugProfileBuildsEnabled].
///
/// See also:
......
......@@ -702,7 +702,7 @@ class _WidgetInspectorService = Object with WidgetInspectorService;
/// operation making it easier to avoid memory leaks.
///
/// All methods in this class are appropriate to invoke from debugging tools
/// using the VM service protocol to evaluate Dart expressions of the
/// using the Observatory service protocol to evaluate Dart expressions of the
/// form `WidgetInspectorService.instance.methodName(arg1, arg2, ...)`. If you
/// make changes to any instance method of this class you need to verify that
/// the [Flutter IntelliJ Plugin](https://github.com/flutter/flutter-intellij/blob/master/README.md)
......@@ -711,7 +711,7 @@ class _WidgetInspectorService = Object with WidgetInspectorService;
/// All methods returning String values return JSON.
mixin WidgetInspectorService {
/// Ring of cached JSON values to prevent JSON from being garbage
/// collected before it can be requested over the VM service protocol.
/// collected before it can be requested over the Observatory protocol.
final List<String?> _serializeRing = List<String?>.filled(20, null);
int _serializeRingIndex = 0;
......@@ -738,7 +738,7 @@ mixin WidgetInspectorService {
/// when the inspection target changes on device.
InspectorSelectionChangedCallback? selectionChangedCallback;
/// The VM service protocol does not keep alive object references so this
/// The Observatory protocol does not keep alive object references so this
/// class needs to manually manage groups of objects that should be kept
/// alive.
final Map<String, Set<_InspectorReferenceData>> _groups = <String, Set<_InspectorReferenceData>>{};
......@@ -1689,7 +1689,7 @@ mixin WidgetInspectorService {
/// Wrapper around `json.encode` that uses a ring of cached values to prevent
/// the Dart garbage collector from collecting objects between when
/// the value is returned over the VM service protocol and when the
/// the value is returned over the Observatory protocol and when the
/// separate observatory protocol command has to be used to retrieve its full
/// contents.
//
......
......@@ -148,7 +148,7 @@ Future<void> run(List<String> args) async {
),
),
watcher: collector,
enableVmService: collector != null,
enableObservatory: collector != null,
precompiledDillFiles: tests,
concurrency: math.max(1, globals.platform.numberOfProcessors - 2),
icudtlPath: globals.fs.path.absolute(argResults[_kOptionIcudtl] as String),
......
......@@ -60,9 +60,9 @@ class Context {
// Thinning is handled during the bundle asset assemble build target, so just embed.
embedFlutterFrameworks();
break;
case 'test_vm_service_bonjour_service':
case 'test_observatory_bonjour_service':
// Exposed for integration testing only.
addVmServiceBonjourService();
addObservatoryBonjourService();
}
}
......@@ -220,11 +220,11 @@ class Context {
],
);
addVmServiceBonjourService();
addObservatoryBonjourService();
}
// Add the vmService publisher Bonjour service to the produced app bundle Info.plist.
void addVmServiceBonjourService() {
// Add the observatory publisher Bonjour service to the produced app bundle Info.plist.
void addObservatoryBonjourService() {
final String buildMode = parseFlutterBuildMode();
// Debug and profile only.
......@@ -239,13 +239,13 @@ class Context {
// The file will be present on re-run.
echo(
'${environment['INFOPLIST_PATH'] ?? ''} does not exist. Skipping '
'_dartVmService._tcp NSBonjourServices insertion. Try re-building to '
'_dartobservatory._tcp NSBonjourServices insertion. Try re-building to '
'enable "flutter attach".');
return;
}
// If there are already NSBonjourServices specified by the app (uncommon),
// insert the vmService service name to the existing list.
// insert the observatory service name to the existing list.
ProcessResult result = runSync(
'plutil',
<String>[
......@@ -265,19 +265,19 @@ class Context {
'-insert',
'NSBonjourServices.0',
'-string',
'_dartVmService._tcp',
'_dartobservatory._tcp',
builtProductsPlist,
],
);
} else {
// Otherwise, add the NSBonjourServices key and vmService service name.
// Otherwise, add the NSBonjourServices key and observatory service name.
runSync(
'plutil',
<String>[
'-insert',
'NSBonjourServices',
'-json',
'["_dartVmService._tcp"]',
'["_dartobservatory._tcp"]',
builtProductsPlist,
],
);
......
......@@ -17,7 +17,7 @@ immediately discover the port
will search for an already running Flutter app or module if available.
Otherwise, the tool will wait for the next Flutter app or module to launch
before attaching.
1. If the app or module is already running and the specific VM Service port is
1. If the app or module is already running and the specific observatory port is
known, it can be explicitly provided to attach via the command-line, e.g.
`$ flutter attach --debug-port 12345`
......
......@@ -140,7 +140,7 @@ This is sent when an app is starting. The `params` field will be a map with the
#### app.debugPort
This is sent when a VM service port is available for a started app. The `params` field will be a map with the fields `appId`, `port`, and `wsUri`. Clients should prefer using the `wsUri` field in preference to synthesizing a URI using the `port` field. An optional field, `baseUri`, is populated if a path prefix is required for setting breakpoints on the target device.
This is sent when an observatory port is available for a started app. The `params` field will be a map with the fields `appId`, `port`, and `wsUri`. Clients should prefer using the `wsUri` field in preference to synthesizing a URI using the `port` field. An optional field, `baseUri`, is populated if a path prefix is required for setting breakpoints on the target device.
#### app.started
......
......@@ -599,12 +599,12 @@ class AndroidDevice extends Device {
}
final bool traceStartup = platformArgs['trace-startup'] as bool? ?? false;
ProtocolDiscovery? vmServiceDiscovery;
ProtocolDiscovery? observatoryDiscovery;
if (debuggingOptions.debuggingEnabled) {
vmServiceDiscovery = ProtocolDiscovery.vmService(
observatoryDiscovery = ProtocolDiscovery.observatory(
// Avoid using getLogReader, which returns a singleton instance, because the
// VM Service discovery will dipose at the end. creating a new logger here allows
// observatory discovery will dipose at the end. creating a new logger here allows
// logs to be surfaced normally during `flutter drive`.
await AdbLogReader.createLogReader(
this,
......@@ -687,13 +687,13 @@ class AndroidDevice extends Device {
}
// Wait for the service protocol port here. This will complete once the
// device has printed "VM Service is listening on...".
_logger.printTrace('Waiting for VM Service port to be available...');
// device has printed "Observatory is listening on...".
_logger.printTrace('Waiting for observatory port to be available...');
try {
Uri? vmServiceUri;
Uri? observatoryUri;
if (debuggingOptions.buildInfo.isDebug || debuggingOptions.buildInfo.isProfile) {
vmServiceUri = await vmServiceDiscovery?.uri;
if (vmServiceUri == null) {
observatoryUri = await observatoryDiscovery?.uri;
if (observatoryUri == null) {
_logger.printError(
'Error waiting for a debug connection: '
'The log reader stopped unexpectedly',
......@@ -701,12 +701,12 @@ class AndroidDevice extends Device {
return LaunchResult.failed();
}
}
return LaunchResult.succeeded(vmServiceUri: vmServiceUri);
return LaunchResult.succeeded(observatoryUri: observatoryUri);
} on Exception catch (error) {
_logger.printError('Error waiting for a debug connection: $error');
return LaunchResult.failed();
} finally {
await vmServiceDiscovery?.cancel();
await observatoryDiscovery?.cancel();
}
}
......
......@@ -35,7 +35,7 @@ class DartDevelopmentService {
final Completer<void> _completer = Completer<void>();
Future<void> startDartDevelopmentService(
Uri vmServiceUri, {
Uri observatoryUri, {
required Logger logger,
int? hostPort,
bool? ipv6,
......@@ -49,11 +49,11 @@ class DartDevelopmentService {
);
logger.printTrace(
'Launching a Dart Developer Service (DDS) instance at $ddsUri, '
'connecting to VM service at $vmServiceUri.',
'connecting to VM service at $observatoryUri.',
);
try {
_ddsInstance = await ddsLauncherCallback(
vmServiceUri,
observatoryUri,
serviceUri: ddsUri,
enableAuthCodes: disableServiceAuthCodes != true,
ipv6: ipv6 ?? false,
......
......@@ -394,16 +394,16 @@ class BuildMode {
throw ArgumentError('$value is not a supported build mode');
}
/// Built in JIT mode with no optimizations, enabled asserts, and a VM service.
/// Built in JIT mode with no optimizations, enabled asserts, and an observatory.
static const BuildMode debug = BuildMode._('debug');
/// Built in AOT mode with some optimizations and a VM service.
/// Built in AOT mode with some optimizations and an observatory.
static const BuildMode profile = BuildMode._('profile');
/// Built in AOT mode with all optimizations and no VM service.
/// Built in AOT mode with all optimizations and no observatory.
static const BuildMode release = BuildMode._('release');
/// Built in JIT mode with all optimizations and no VM service.
/// Built in JIT mode with all optimizations and no observatory.
static const BuildMode jitRelease = BuildMode._('jit_release');
static const List<BuildMode> values = <BuildMode>[
......
......@@ -56,7 +56,7 @@ import '../vmservice.dart';
/// ```
/// $ flutter attach
/// ```
/// As soon as a new VM Service is detected the command attaches to it and
/// As soon as a new observatory is detected the command attaches to it and
/// enables hot reloading.
///
/// To attach to a flutter mod running on a fuchsia device, `--module` must
......@@ -97,18 +97,18 @@ class AttachCommand extends FlutterCommand {
..addOption(
'debug-port',
hide: !verboseHelp,
help: '(deprecated) Device port where the Dart VM Service is listening. Requires '
help: '(deprecated) Device port where the observatory is listening. Requires '
'"--disable-service-auth-codes" to also be provided to the Flutter '
'application at launch, otherwise this command will fail to connect to '
'the application. In general, "--debug-url" should be used instead.',
)..addOption(
'debug-url',
aliases: <String>[ 'debug-uri' ], // supported for historical reasons
help: 'The URL at which the Dart VM Service is listening.',
help: 'The URL at which the observatory is listening.',
)..addOption(
'app-id',
help: 'The package name (Android) or bundle identifier (iOS) for the app. '
'This can be specified to avoid being prompted if multiple Dart VM Service ports '
'This can be specified to avoid being prompted if multiple observatory ports '
'are advertised.\n'
'If you have multiple devices or emulators running, you should include the '
'device hostname as well, e.g. "com.example.myApp@my-iphone".\n'
......@@ -169,7 +169,7 @@ For Fuchsia, the module name must be provided, e.g. `$flutter attach
--module=mod_name`. This can be called either before or after the application
is started.
If the app or module is already running and the specific vmService port is
If the app or module is already running and the specific observatory port is
known, it can be explicitly provided to attach via the command-line, e.g.
`$ flutter attach --debug-port 12345`''';
......@@ -225,10 +225,10 @@ known, it can be explicitly provided to attach via the command-line, e.g.
'the value of --ipv6 on its own.',
);
}
if (debugPort == null && debugUri == null && argResults!.wasParsed(FlutterCommand.vmServicePortOption)) {
if (debugPort == null && debugUri == null && argResults!.wasParsed(FlutterCommand.observatoryPortOption)) {
throwToolExit(
'When the --debug-port or --debug-url is unknown, this command does not use '
'the value of --vm-service-port.',
'the value of --observatory-port.',
);
}
if (debugPort != null && debugUri != null) {
......@@ -281,7 +281,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
)
: null;
Stream<Uri>? vmServiceUri;
Stream<Uri>? observatoryUri;
bool usesIpv6 = ipv6!;
final String ipv6Loopback = InternetAddress.loopbackIPv6.address;
final String ipv4Loopback = InternetAddress.loopbackIPv4.address;
......@@ -298,7 +298,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
FuchsiaIsolateDiscoveryProtocol? isolateDiscoveryProtocol;
try {
isolateDiscoveryProtocol = device.getIsolateDiscoveryProtocol(module);
vmServiceUri = Stream<Uri>.value(await isolateDiscoveryProtocol.uri).asBroadcastStream();
observatoryUri = Stream<Uri>.value(await isolateDiscoveryProtocol.uri).asBroadcastStream();
} on Exception {
isolateDiscoveryProtocol?.dispose();
final List<ForwardedPort> ports = device.portForwarder.forwardedPorts.toList();
......@@ -351,7 +351,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
Future<Uri?>? protocolDiscoveryFuture;
if (compatibleWithProtocolDiscovery) {
final ProtocolDiscovery vmServiceDiscovery = ProtocolDiscovery.vmService(
final ProtocolDiscovery vmServiceDiscovery = ProtocolDiscovery.observatory(
device.getLogReader(),
portForwarder: device.portForwarder,
ipv6: ipv6!,
......@@ -372,14 +372,14 @@ known, it can be explicitly provided to attach via the command-line, e.g.
}
discoveryStatus.stop();
vmServiceUri = foundUrl == null
observatoryUri = foundUrl == null
? null
: Stream<Uri>.value(foundUrl).asBroadcastStream();
}
// If MDNS discovery fails or we're not on iOS, fallback to ProtocolDiscovery.
if (vmServiceUri == null) {
final ProtocolDiscovery vmServiceDiscovery =
ProtocolDiscovery.vmService(
if (observatoryUri == null) {
final ProtocolDiscovery observatoryDiscovery =
ProtocolDiscovery.observatory(
// If it's an Android device, attaching relies on past log searching
// to find the service protocol.
await device.getLogReader(includePastLogs: device is AndroidDevice),
......@@ -390,12 +390,12 @@ known, it can be explicitly provided to attach via the command-line, e.g.
logger: _logger,
);
_logger.printStatus('Waiting for a connection from Flutter on ${device.name}...');
vmServiceUri = vmServiceDiscovery.uris;
observatoryUri = observatoryDiscovery.uris;
// Determine ipv6 status from the scanned logs.
usesIpv6 = vmServiceDiscovery.ipv6;
usesIpv6 = observatoryDiscovery.ipv6;
}
} else {
vmServiceUri = Stream<Uri>
observatoryUri = Stream<Uri>
.fromFuture(
buildVMServiceUri(
device,
......@@ -413,7 +413,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
int? result;
if (daemon != null) {
final ResidentRunner runner = await createResidentRunner(
vmServiceUris: vmServiceUri,
observatoryUris: observatoryUri,
device: device,
flutterProject: flutterProject,
usesIpv6: usesIpv6,
......@@ -446,7 +446,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
}
while (true) {
final ResidentRunner runner = await createResidentRunner(
vmServiceUris: vmServiceUri,
observatoryUris: observatoryUri,
device: device,
flutterProject: flutterProject,
usesIpv6: usesIpv6,
......@@ -476,7 +476,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
}
terminalHandler?.stop();
assert(result != null);
if (runner.exited || !runner.isWaitingForVmService) {
if (runner.exited || !runner.isWaitingForObservatory) {
break;
}
_logger.printStatus('Waiting for a new connection from Flutter on ${device.name}...');
......@@ -495,7 +495,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
}
Future<ResidentRunner> createResidentRunner({
required Stream<Uri> vmServiceUris,
required Stream<Uri> observatoryUris,
required Device device,
required FlutterProject flutterProject,
required bool usesIpv6,
......@@ -510,7 +510,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
userIdentifier: userIdentifier,
platform: _platform,
);
flutterDevice.vmServiceUris = vmServiceUris;
flutterDevice.observatoryUris = observatoryUris;
final List<FlutterDevice> flutterDevices = <FlutterDevice>[flutterDevice];
final DebuggingOptions debuggingOptions = DebuggingOptions.enabled(
buildInfo,
......
......@@ -650,7 +650,7 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase {
description: 'Should the device use port forwarding? '
'Using port forwarding is the default because it works in all cases, however if your '
'remote device has a static IP address and you have a way of '
'specifying the "--vm-service-host=<ip>" engine option, you might prefer '
'specifying the "--observatory-host=<ip>" engine option, you might prefer '
'not using port forwarding.',
);
......
......@@ -1014,9 +1014,7 @@ class DeviceDomain extends Domain {
);
return <String, Object?>{
'started': result.started,
'vmServiceUri': result.vmServiceUri?.toString(),
// TODO(bkonyi): remove once clients have migrated to relying on vmServiceUri.
'observatoryUri': result.vmServiceUri?.toString(),
'observatoryUri': result.observatoryUri?.toString(),
};
}
......
Supports Markdown
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