Repository navigation
[stable] [flutter_tools] Report preview reload timing analytics in LspPreviewDetector - #192256
Conversation
…etector (flutter#192120) In Flutter 3.44 ([flutter#184473](flutter#184473)), `LspPreviewDetector` became the default preview detector, but did not instrument `previewAnalytics.startPreviewReloadStopwatch()` or `previewAnalytics.reportPreviewReloadTiming()`. This caused a severe drop in reported `preview-reload-time` telemetry events. This change instruments `LspPreviewDetector` to start the reload stopwatch on file changes, report reload timings after change detection completes, and reset the stopwatch on errors. Non-Dart file edits are also filtered out to avoid unnecessary reload events. - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
|
This pull request was opened from and to a release candidate branch. This should only be done as part of the official Flutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions at Tree Hygiene for detailed instructions on contributing to Flutter. Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed. |
There was a problem hiding this comment.
Code Review
This pull request introduces file type filtering to ignore non-Dart files and adds stopwatch-based analytics timing for preview reloads in LspPreviewDetector. It also includes a comprehensive unit test suite to verify these changes. The review feedback points out a redundant and unreachable return; statement after a rethrow; inside the catch block of LspPreviewDetector.
|
@bkonyi, same here :) |
4c685f8
into
flutter:flutter-3.47-candidate.0
This pull request is created by automatic cherry pick workflow
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.
Issue Link:
#192120
Impact Description:
In Flutter 3.44 (#184473),
LspPreviewDetectorbecame the default preview detector, but did not instrument preview reload timing analytics (previewAnalytics.startPreviewReloadStopwatch()andpreviewAnalytics.reportPreviewReloadTiming()). This caused a severe drop in reportedpreview-reload-timetelemetry events for the widget previewer. This cherry-pick restores reporting of reload timing metrics and filters out non-Dart file edits to avoid spurious reload timing events.Changelog Description:
[flutter/192120] Fixes missing preview reload timing analytics in LspPreviewDetector across all platforms.
Workaround:
None. Telemetry for widget preview reload timing is omitted unless instrumented.
Risk:
What is the risk level of this cherry-pick?
Test Coverage:
Are you confident that your fix is well-tested by automated tests?
Validation Steps:
Run
packages/flutter_toolsunit tests:dart test test/commands.shard/hermetic/widget_preview/lsp_preview_detector_test.dart