diff --git a/pkgs/unified_analytics/CHANGELOG.md b/pkgs/unified_analytics/CHANGELOG.md index 0a53660bf..999068baa 100644 --- a/pkgs/unified_analytics/CHANGELOG.md +++ b/pkgs/unified_analytics/CHANGELOG.md @@ -1,6 +1,8 @@ -## 6.1.3-wip +## 6.1.3 - Require Dart 3.4. +- Added `isWasm` parameter to the `Event.devtoolsEvent` constructor. +- Added an optional parameter `data` to the `Event.exception` constructor. ## 6.1.2 diff --git a/pkgs/unified_analytics/lib/src/constants.dart b/pkgs/unified_analytics/lib/src/constants.dart index 42b9952f8..5cef5743f 100644 --- a/pkgs/unified_analytics/lib/src/constants.dart +++ b/pkgs/unified_analytics/lib/src/constants.dart @@ -87,7 +87,7 @@ const int kMaxLogFileSize = 25 * (1 << 20); const String kLogFileName = 'dart-flutter-telemetry.log'; /// The current version of the package, should be in line with pubspec version. -const String kPackageVersion = '6.1.3-wip'; +const String kPackageVersion = '6.1.3'; /// The minimum length for a session. const int kSessionDurationMinutes = 30; diff --git a/pkgs/unified_analytics/lib/src/event.dart b/pkgs/unified_analytics/lib/src/event.dart index 8a720a245..0713a3816 100644 --- a/pkgs/unified_analytics/lib/src/event.dart +++ b/pkgs/unified_analytics/lib/src/event.dart @@ -378,6 +378,7 @@ final class Event { String? isExternalBuild, String? isEmbedded, String? ideLaunchedFeature, + String? isWasm, // PerformanceScreenMetrics int? uiDurationMicros, @@ -419,6 +420,7 @@ final class Event { if (isEmbedded != null) 'isEmbedded': isEmbedded, if (ideLaunchedFeature != null) 'ideLaunchedFeature': ideLaunchedFeature, + if (isWasm != null) 'isWasm': isWasm, // PerformanceScreenMetrics if (uiDurationMicros != null) 'uiDurationMicros': uiDurationMicros, @@ -480,9 +482,15 @@ final class Event { /// exception that we want to log. /// /// [exception] - string representation of the exception that occured. - Event.exception({required String exception}) - : eventName = DashEvent.exception, - eventData = {'exception': exception}; + /// [data] - optional structured data to include with the exception event. + Event.exception({ + required String exception, + Map data = const {}, + }) : eventName = DashEvent.exception, + eventData = { + 'exception': exception, + ...data, + }; /// Event that is emitted from the flutter tool when a build invocation /// has been run by the user. diff --git a/pkgs/unified_analytics/pubspec.yaml b/pkgs/unified_analytics/pubspec.yaml index 3e7065cfd..237b4fa37 100644 --- a/pkgs/unified_analytics/pubspec.yaml +++ b/pkgs/unified_analytics/pubspec.yaml @@ -4,7 +4,7 @@ description: >- to Google Analytics. # When updating this, keep the version consistent with the changelog and the # value in lib/src/constants.dart. -version: 6.1.3-wip +version: 6.1.3 repository: https://github.com/dart-lang/tools/tree/main/pkgs/unified_analytics environment: diff --git a/pkgs/unified_analytics/test/event_test.dart b/pkgs/unified_analytics/test/event_test.dart index 0a6167f4e..ddfb4e731 100644 --- a/pkgs/unified_analytics/test/event_test.dart +++ b/pkgs/unified_analytics/test/event_test.dart @@ -429,14 +429,19 @@ void main() { }); test('Event.exception constructed', () { - Event generateEvent() => Event.exception(exception: 'exception'); + Event generateEvent() => Event.exception( + exception: 'exception', + data: {'foo': 'bar', 'baz': 1}, + ); final constructedEvent = generateEvent(); expect(generateEvent, returnsNormally); expect(constructedEvent.eventName, DashEvent.exception); expect(constructedEvent.eventData['exception'], 'exception'); - expect(constructedEvent.eventData.length, 1); + expect(constructedEvent.eventData['foo'], 'bar'); + expect(constructedEvent.eventData['baz'], 1); + expect(constructedEvent.eventData.length, 3); }); test('Event.timing constructed', () { @@ -570,6 +575,7 @@ void main() { isExternalBuild: 'isExternalBuild', isEmbedded: 'isEmbedded', ideLaunchedFeature: 'ideLaunchedFeature', + isWasm: 'true', uiDurationMicros: 123, rasterDurationMicros: 123, shaderCompilationDurationMicros: 123, @@ -603,6 +609,8 @@ void main() { expect(constructedEvent.eventData['isEmbedded'], 'isEmbedded'); expect( constructedEvent.eventData['ideLaunchedFeature'], 'ideLaunchedFeature'); + expect(constructedEvent.eventData['isWasm'], 'true'); + expect(constructedEvent.eventData['uiDurationMicros'], 123); expect(constructedEvent.eventData['rasterDurationMicros'], 123); expect(constructedEvent.eventData['shaderCompilationDurationMicros'], 123); @@ -615,7 +623,7 @@ void main() { expect(constructedEvent.eventData['rootSetCount'], 123); expect(constructedEvent.eventData['rowCount'], 123); expect(constructedEvent.eventData['inspectorTreeControllerId'], 123); - expect(constructedEvent.eventData.length, 27); + expect(constructedEvent.eventData.length, 28); }); test('Confirm all constructors were checked', () {