Skip to content

Add wasm dry run event to unified analytics. #2125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkgs/unified_analytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 8.0.4
- Changed `Event.flutterWasmDryRun` to track dart2wasm dry run metrics from Flutter.

## 8.0.3
- Changed `Event.contextStructure` to make optional data that's no longer being
collected and to add data about the size of library cycles.
Expand Down
5 changes: 5 additions & 0 deletions pkgs/unified_analytics/lib/src/enums.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ enum DashEvent {
description: 'Provides information about flutter commands that ran',
toolOwner: DashTool.flutterTool,
),
flutterWasmDryRun(
label: 'wasm_dry_run',
description: 'Information for a dart2wasm dry run invoked from Flutter',
toolOwner: DashTool.flutterTool,
),
flutterInjectDarwinPlugins(
label: 'flutter_inject_darwin_plugins',
description: 'Information on plugins injected into an iOS/macOS project',
Expand Down
13 changes: 13 additions & 0 deletions pkgs/unified_analytics/lib/src/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,19 @@ final class Event {
},
);

Event.flutterWasmDryRun({
required String result,
required int exitCode,
String? findingsSummary,
}) : this._(
eventName: DashEvent.flutterWasmDryRun,
eventData: {
'result': result,
'exitCode': result,
if (findingsSummary != null) 'findings': findingsSummary,
},
);

/// Provides information about the plugins injected into an iOS or macOS
/// project.
///
Expand Down
2 changes: 1 addition & 1 deletion pkgs/unified_analytics/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: >-
# LINT.IfChange
# When updating this, keep the version consistent with the changelog and the
# value in lib/src/constants.dart.
version: 8.0.3
version: 8.0.4
# LINT.ThenChange(lib/src/constants.dart)
repository: https://github.com/dart-lang/tools/tree/main/pkgs/unified_analytics
issue_tracker: https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aunified_analytics
Expand Down
44 changes: 44 additions & 0 deletions pkgs/unified_analytics/test/event_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,50 @@ void main() {
expect(constructedEvent.eventData.length, 4);
});

test('Event.flutterWasmDryRun constructed', () {
Event generateEventNoFindings() => Event.flutterWasmDryRun(
result: 'success',
exitCode: 123,
);

final constructedEvent1 = generateEventNoFindings();

expect(generateEventNoFindings, returnsNormally);
expect(constructedEvent1.eventName, DashEvent.flutterWasmDryRun);
expect(constructedEvent1.eventData['result'], 'success');
expect(constructedEvent1.eventData['exitCode'], 123);
expect(constructedEvent1.eventData.length, 2);
});
test('Event.flutterWasmDryRun constructed', () {
Event generateEventNoFindings() => Event.flutterWasmDryRun(
result: 'success',
exitCode: 123,
);

final constructedEvent1 = generateEventNoFindings();

expect(generateEventNoFindings, returnsNormally);
expect(constructedEvent1.eventName, DashEvent.flutterWasmDryRun);
expect(constructedEvent1.eventData['result'], 'success');
expect(constructedEvent1.eventData['exitCode'], 123);
expect(constructedEvent1.eventData.length, 2);

Event generateEventFindings() => Event.flutterWasmDryRun(
result: 'success',
exitCode: 123,
findingsSummary: '1,2,3'
);

final constructedEvent2 = generateEventFindings();

expect(generateEventFindings, returnsNormally);
expect(constructedEvent2.eventName, DashEvent.flutterWasmDryRun);
expect(constructedEvent2.eventData['result'], 'success');
expect(constructedEvent2.eventData['exitCode'], 123);
expect(constructedEvent2.eventData['findingsSummary'], '1,2,3');
expect(constructedEvent2.eventData.length, 3);
});

test('Event.flutterInjectDarwinPlugins constructed', () {
Event generateEvent() => Event.flutterInjectDarwinPlugins(
platform: 'ios',
Expand Down
Loading