Skip to content

Initial implementation of network profiling page - #1508

Merged
bkonyi merged 22 commits into
flutter:masterfrom
bkonyi:networkPage
Jan 16, 2020
Merged

bkonyi merged 22 commits into
flutter:masterfrom
bkonyi:networkPage

Conversation

@bkonyi

@bkonyi bkonyi commented Jan 3, 2020 •

Copy link
Copy Markdown
Contributor

Looking for initial comments and feedback. Happy to add tests when I'm up to it, if requested.

This isn't quite ready to land as it depends on the following PRs landing in the Flutter framework:

Screenshots:
No requests recorded
Screen Shot 2020-01-06 at 9 36 22 AM

Recording, waiting for first request
Screen Shot 2020-01-06 at 9 35 57 AM

Recordings received, none selected
Screen Shot 2020-01-06 at 9 37 21 AM

General request information and headers
Screen Shot 2020-01-06 at 9 38 26 AM

Request timing information
Screen Shot 2020-01-06 at 9 38 31 AM

Cookies tab (only response cookies shown here, but response cookies are also displayed). This tab is hidden when there are no cookies for a request
Screen Shot 2020-01-06 at 9 40 24 AM

@DaveShuckerow DaveShuckerow left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen lots of people make meaningful engineering contributions to Flutter apps within their first week, but this is still very impressive.

I left a couple of suggestions on style and structural improvements.

I also left some changes necessary to know the code will work through failure cases.

Also, can you please include a screenshot of this page?

Comment thread packages/devtools_app/lib/src/flutter/common_widgets.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/network_screen.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/network_screen.dart Outdated
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// This library contains code pulled from dart:io that is not platform specific.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this works on web, it's a shame we can't just import it from dart:io.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ditman who is interested in answering just that sort of question. :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, there's no platform specific code in a large portion of the dart:_http code :-(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, and I don't want to derail this PR, but maybe some of the base work here (Cookie, Http Headers...) may have a better home in package:http?

(This is something that can be extracted/refactored later)

Comment thread packages/devtools_app/lib/src/network/network_controller.dart
Comment thread packages/devtools_app/lib/src/network/flutter/http_headers_tab.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/http_request_inspector.dart Outdated
import '../network_controller.dart';
import 'http_request_inspector.dart';

class HttpRequestDataTableSource extends DataTableSource {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class will need tests.

Comment thread packages/devtools_app/lib/src/network/flutter/network_screen.dart Outdated
Comment thread packages/devtools_app/lib/src/network/http_request_data.dart Outdated

@kenzieschmoll kenzieschmoll left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done with initial round of comments.

Great to see this code! Can you add some screenshots to the PR description?

Comment thread packages/devtools_app/lib/src/flutter/common_widgets.dart Outdated
Comment thread packages/devtools_app/lib/src/flutter/common_widgets.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/http_cookies_tab.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/http_cookies_tab.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/http_cookies_tab.dart Outdated
Comment thread packages/devtools_app/lib/src/network/network_controller.dart Outdated
Comment thread packages/devtools_app/lib/src/network/network_controller.dart Outdated
Future<void> _forEachIsolate(Future Function(IsolateRef) callback) async {
final vm = await serviceManager.service.getVM();
final futures = <Future>[];
for (final isolate in vm.isolates) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is vm.isolates subject to change while this for loop is executing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically a new isolate could be spawned while this loop is executing but I'm not sure it's worth handling that edge case unless it becomes a problem.

Comment thread packages/devtools_app/lib/src/network/network_controller.dart Outdated
Comment thread packages/devtools_app/lib/src/network/network_controller.dart
Comment thread packages/devtools_app/lib/src/flutter/app.dart
@devoncarew

Copy link
Copy Markdown
Contributor

As a drive by comment, when adding or changing significant UI you probably want to add a few screenshots - it'll help reviewers get a sense for the UI changes.

Comment thread packages/devtools_app/lib/src/network/flutter/http_cookies_tab.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/http_cookies_tab.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/http_cookies_tab.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/http_cookies_tab.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/http_timing_tab.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/http_timing_tab.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/network_screen.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/network_screen.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/network_screen.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/network_screen.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/network_screen.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/network_screen.dart Outdated
Comment thread packages/devtools_app/lib/src/network/http_request_data.dart Outdated
Comment thread packages/devtools_app/lib/src/network/http_request_data.dart
requests: currentValues, outstanding: outstandingRequestsMap);
}

void _startPolling() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also document how we make sure we stop polling?

@jacob314 jacob314 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a an amazing start!
To test this code there are two reasonable options:

  1. write a combination of unittests tests against the controller and widget tests that exercise the the full ui.
  2. write all tests as widget tests against the full ui.
    You can see the existing tests for examples of controller tests that connect the controller to a real dart application. We don't yet have widget tests that connect to a real dart application that I know of but that is something we should change soon.

@bkonyi

bkonyi commented Jan 6, 2020

Copy link
Copy Markdown
Contributor Author

Thanks everyone for the initial comments! You're going to keep me busy... :-)

I've uploaded screenshots in the PR description. Let me know if there's something I missed that you'd like a screenshot of.

Comment thread packages/devtools_app/lib/src/network/flutter/http_cookies_tab.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/http_headers_tab.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/http_cookies_tab.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/http_headers_tab.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/network_screen.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/network_screen.dart
Comment thread packages/devtools_app/lib/src/network/flutter/http_request_inspector_views.dart Outdated
Comment thread packages/devtools_app/lib/src/network/flutter/http_request_inspector_views.dart Outdated
@bkonyi

bkonyi commented Jan 10, 2020

Copy link
Copy Markdown
Contributor Author

I think I've covered the majority of the requested refactoring and theming work (still need to deal with the paddings). I'll get started on tests once people are happy with the general structure of the change. Please take another look when you have a chance.

Also, flutter/flutter#47552 and flutter/flutter#48531 have landed so this change should work properly as of flutter/flutter@d907a26.

@jacob314 jacob314 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!
lgtm This is solid enough to land and iterate on further.

@bkonyi
bkonyi merged commit a4aeef7 into flutter:master Jan 16, 2020
@bkonyi
bkonyi deleted the networkPage branch January 16, 2020 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants