Skip to content

Commit

Permalink
Remove references to Observatory
Browse files Browse the repository at this point in the history
Observatory is being deprecated for Dart 3.0 so it should no longer be
referenced in tooling messaging / flags.

See dart-lang/sdk#50233
  • Loading branch information
bkonyi committed Jan 16, 2023
1 parent 8c2fdb8 commit 96f68e1
Show file tree
Hide file tree
Showing 92 changed files with 522 additions and 521 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/5_performance_speed.md
Expand Up @@ -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 Observatory and save a timeline trace of the performance issue
5. Open Flutter DevTools 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
Expand Down
2 changes: 1 addition & 1 deletion dev/devicelab/lib/framework/runner.dart
Expand Up @@ -190,7 +190,7 @@ Future<TaskResult> runTask(
.transform<String>(const LineSplitter())
.listen((String line) {
if (!uri.isCompleted) {
final Uri? serviceUri = parseServiceUri(line, prefix: RegExp('(Observatory|The Dart VM service is) listening on '));
final Uri? serviceUri = parseServiceUri(line, prefix: RegExp('The Dart VM service is listening on '));
if (serviceUri != null) {
uri.complete(serviceUri);
}
Expand Down
6 changes: 3 additions & 3 deletions dev/devicelab/lib/framework/utils.dart
Expand Up @@ -707,14 +707,14 @@ Future<void> runAndCaptureAsyncStacks(Future<void> Function() callback) {
bool canRun(String path) => _processManager.canRun(path);

final RegExp _obsRegExp =
RegExp('An Observatory debugger .* is available at: ');
RegExp('A Dart VM Service .* 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: `An Observatory debugger .* is available at: `.
/// `prefix` defaults to the RegExp: `A Dart VM Service .* is available at: `.
int? parseServicePort(String line, {
Pattern? prefix,
}) {
Expand All @@ -732,7 +732,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: `An Observatory debugger .* is available at: `.
/// `prefix` defaults to the RegExp: `A Dart VM Service .* is available at: `.
Uri? parseServiceUri(String line, {
Pattern? prefix,
}) {
Expand Down
8 changes: 4 additions & 4 deletions dev/devicelab/lib/tasks/perf_tests.dart
Expand Up @@ -1184,11 +1184,11 @@ class PerfTestWithSkSL extends PerfTest {
await _generateSkSL();

// Build the app with SkSL artifacts and run that app
final String observatoryUri = await _runApp(skslPath: _skslJsonFileName);
final String vmServiceUri = await _runApp(skslPath: _skslJsonFileName);

// Attach to the running app and run the final driver test to get metrics.
final TaskResult result = await internalRun(
existingApp: observatoryUri,
existingApp: vmServiceUri,
);

_runProcess.kill();
Expand All @@ -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 observatoryUri = await _runApp(cacheSkSL: true);
await super.internalRun(cacheSkSL: true, existingApp: observatoryUri);
final String vmServiceUri = await _runApp(cacheSkSL: true);
await super.internalRun(cacheSkSL: true, existingApp: vmServiceUri);
_runProcess.kill();
await _runProcess.exitCode;

Expand Down
2 changes: 1 addition & 1 deletion dev/devicelab/test/utils_test.dart
Expand Up @@ -19,7 +19,7 @@ void main() {

group('parse service', () {
const String badOutput = 'No uri here';
const String sampleOutput = 'An Observatory debugger and profiler on '
const String sampleOutput = 'A Dart VM Service on '
'Pixel 3 XL is available at: http://127.0.0.1:9090/LpjUpsdEjqI=/';

test('uri', () {
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/foundation/binding.dart
Expand Up @@ -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
/// observatory service extensions, if any.
/// VM service extensions, if any.
BindingBase() {
developer.Timeline.startSync('Framework initialization');
assert(() {
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/lib/src/painting/shader_warm_up.dart
Expand Up @@ -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
/// --observatory-uri=<uri> --type=skia` and analyzing it with
/// --vm-service-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
/// observatory timeline to see which Skia draw operations are commonly used,
/// Flutter DevTools timeline to see which Skia draw operations are commonly used,
/// and which shader compilations are causing jank.
@protected
Future<void> warmUpOnCanvas(ui.Canvas canvas);
Expand Down
6 changes: 3 additions & 3 deletions packages/flutter/lib/src/widgets/app.dart
Expand Up @@ -1180,7 +1180,7 @@ class WidgetsApp extends StatefulWidget {

/// If true, forces the performance overlay to be visible in all instances.
///
/// Used by the `showPerformanceOverlay` observatory extension.
/// Used by the `showPerformanceOverlay` VM service extension.
static bool showPerformanceOverlayOverride = false;

/// If true, forces the widget inspector to be visible.
Expand All @@ -1190,12 +1190,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 Observatory.
/// more detailed information is shown in the IDE or DevTools.
static bool debugShowWidgetInspectorOverride = false;

/// If false, prevents the debug banner from being visible.
///
/// Used by the `debugAllowBanner` observatory extension.
/// Used by the `debugAllowBanner` VM service extension.
///
/// This is how `flutter run` turns off the banner when you take a screen shot
/// with "s".
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/lib/src/widgets/debug.dart
Expand Up @@ -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 the
/// Observatory rather than getting it in the console (where it can be
/// 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
/// overwhelming), consider [debugProfileBuildsEnabled].
///
/// See also:
Expand Down
8 changes: 4 additions & 4 deletions packages/flutter/lib/src/widgets/widget_inspector.dart
Expand Up @@ -707,7 +707,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 Observatory service protocol to evaluate Dart expressions of the
/// using the VM 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)
Expand All @@ -716,7 +716,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 Observatory protocol.
/// collected before it can be requested over the VM service protocol.
final List<String?> _serializeRing = List<String?>.filled(20, null);
int _serializeRingIndex = 0;

Expand All @@ -743,7 +743,7 @@ mixin WidgetInspectorService {
/// when the inspection target changes on device.
InspectorSelectionChangedCallback? selectionChangedCallback;

/// The Observatory protocol does not keep alive object references so this
/// The VM service 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>>{};
Expand Down Expand Up @@ -1679,7 +1679,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 Observatory protocol and when the
/// the value is returned over the VM service protocol and when the
/// separate observatory protocol command has to be used to retrieve its full
/// contents.
//
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_tools/bin/fuchsia_tester.dart
Expand Up @@ -148,7 +148,7 @@ Future<void> run(List<String> args) async {
),
),
watcher: collector,
enableObservatory: collector != null,
enableVmService: collector != null,
precompiledDillFiles: tests,
concurrency: math.max(1, globals.platform.numberOfProcessors - 2),
icudtlPath: globals.fs.path.absolute(argResults[_kOptionIcudtl] as String),
Expand Down
20 changes: 10 additions & 10 deletions packages/flutter_tools/bin/xcode_backend.dart
Expand Up @@ -60,9 +60,9 @@ class Context {
// Thinning is handled during the bundle asset assemble build target, so just embed.
embedFlutterFrameworks();
break;
case 'test_observatory_bonjour_service':
case 'test_vm_service_bonjour_service':
// Exposed for integration testing only.
addObservatoryBonjourService();
addVmServiceBonjourService();
}
}

Expand Down Expand Up @@ -220,11 +220,11 @@ class Context {
],
);

addObservatoryBonjourService();
addVmServiceBonjourService();
}

// Add the observatory publisher Bonjour service to the produced app bundle Info.plist.
void addObservatoryBonjourService() {
// Add the vmService publisher Bonjour service to the produced app bundle Info.plist.
void addVmServiceBonjourService() {
final String buildMode = parseFlutterBuildMode();

// Debug and profile only.
Expand All @@ -239,13 +239,13 @@ class Context {
// The file will be present on re-run.
echo(
'${environment['INFOPLIST_PATH'] ?? ''} does not exist. Skipping '
'_dartobservatory._tcp NSBonjourServices insertion. Try re-building to '
'_dartvmService._tcp NSBonjourServices insertion. Try re-building to '
'enable "flutter attach".');
return;
}

// If there are already NSBonjourServices specified by the app (uncommon),
// insert the observatory service name to the existing list.
// insert the vmService service name to the existing list.
ProcessResult result = runSync(
'plutil',
<String>[
Expand All @@ -265,19 +265,19 @@ class Context {
'-insert',
'NSBonjourServices.0',
'-string',
'_dartobservatory._tcp',
'_dartvmService._tcp',
builtProductsPlist,
],
);
} else {
// Otherwise, add the NSBonjourServices key and observatory service name.
// Otherwise, add the NSBonjourServices key and vmService service name.
runSync(
'plutil',
<String>[
'-insert',
'NSBonjourServices',
'-json',
'["_dartobservatory._tcp"]',
'["_dartvmService._tcp"]',
builtProductsPlist,
],
);
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_tools/doc/attach.md
Expand Up @@ -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 observatory port is
1. If the app or module is already running and the specific VM Service port is
known, it can be explicitly provided to attach via the command-line, e.g.
`$ flutter attach --debug-port 12345`

Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_tools/doc/daemon.md
Expand Up @@ -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 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.
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.

#### app.started

Expand Down
20 changes: 10 additions & 10 deletions packages/flutter_tools/lib/src/android/android_device.dart
Expand Up @@ -599,12 +599,12 @@ class AndroidDevice extends Device {
}

final bool traceStartup = platformArgs['trace-startup'] as bool? ?? false;
ProtocolDiscovery? observatoryDiscovery;
ProtocolDiscovery? vmServiceDiscovery;

if (debuggingOptions.debuggingEnabled) {
observatoryDiscovery = ProtocolDiscovery.observatory(
vmServiceDiscovery = ProtocolDiscovery.vmService(
// Avoid using getLogReader, which returns a singleton instance, because the
// observatory discovery will dipose at the end. creating a new logger here allows
// VM Service discovery will dipose at the end. creating a new logger here allows
// logs to be surfaced normally during `flutter drive`.
await AdbLogReader.createLogReader(
this,
Expand Down Expand Up @@ -687,26 +687,26 @@ class AndroidDevice extends Device {
}

// Wait for the service protocol port here. This will complete once the
// device has printed "Observatory is listening on...".
_logger.printTrace('Waiting for observatory port to be available...');
// device has printed "VM Service is listening on...".
_logger.printTrace('Waiting for VM Service port to be available...');
try {
Uri? observatoryUri;
Uri? vmServiceUri;
if (debuggingOptions.buildInfo.isDebug || debuggingOptions.buildInfo.isProfile) {
observatoryUri = await observatoryDiscovery?.uri;
if (observatoryUri == null) {
vmServiceUri = await vmServiceDiscovery?.uri;
if (vmServiceUri == null) {
_logger.printError(
'Error waiting for a debug connection: '
'The log reader stopped unexpectedly',
);
return LaunchResult.failed();
}
}
return LaunchResult.succeeded(observatoryUri: observatoryUri);
return LaunchResult.succeeded(vmServiceUri: vmServiceUri);
} on Exception catch (error) {
_logger.printError('Error waiting for a debug connection: $error');
return LaunchResult.failed();
} finally {
await observatoryDiscovery?.cancel();
await vmServiceDiscovery?.cancel();
}
}

Expand Down
6 changes: 3 additions & 3 deletions packages/flutter_tools/lib/src/base/dds.dart
Expand Up @@ -35,7 +35,7 @@ class DartDevelopmentService {
final Completer<void> _completer = Completer<void>();

Future<void> startDartDevelopmentService(
Uri observatoryUri, {
Uri vmServiceUri, {
required Logger logger,
int? hostPort,
bool? ipv6,
Expand All @@ -49,11 +49,11 @@ class DartDevelopmentService {
);
logger.printTrace(
'Launching a Dart Developer Service (DDS) instance at $ddsUri, '
'connecting to VM service at $observatoryUri.',
'connecting to VM service at $vmServiceUri.',
);
try {
_ddsInstance = await ddsLauncherCallback(
observatoryUri,
vmServiceUri,
serviceUri: ddsUri,
enableAuthCodes: disableServiceAuthCodes != true,
ipv6: ipv6 ?? false,
Expand Down
8 changes: 4 additions & 4 deletions packages/flutter_tools/lib/src/build_info.dart
Expand Up @@ -405,16 +405,16 @@ class BuildMode {
throw ArgumentError('$value is not a supported build mode');
}

/// Built in JIT mode with no optimizations, enabled asserts, and an observatory.
/// Built in JIT mode with no optimizations, enabled asserts, and a VM service.
static const BuildMode debug = BuildMode._('debug');

/// Built in AOT mode with some optimizations and an observatory.
/// Built in AOT mode with some optimizations and a VM service.
static const BuildMode profile = BuildMode._('profile');

/// Built in AOT mode with all optimizations and no observatory.
/// Built in AOT mode with all optimizations and no VM service.
static const BuildMode release = BuildMode._('release');

/// Built in JIT mode with all optimizations and no observatory.
/// Built in JIT mode with all optimizations and no VM service.
static const BuildMode jitRelease = BuildMode._('jit_release');

static const List<BuildMode> values = <BuildMode>[
Expand Down

0 comments on commit 96f68e1

Please sign in to comment.