Skip to content

Commit 79e3b8e

Browse files
Added a couple parameters to Event.devtoolsEvent and Event.exception (#584)
1 parent 55f6a0e commit 79e3b8e

File tree

5 files changed

+27
-9
lines changed

5 files changed

+27
-9
lines changed

pkgs/unified_analytics/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
## 6.1.3-wip
1+
## 6.1.3
22

33
- Require Dart 3.4.
4+
- Added `isWasm` parameter to the `Event.devtoolsEvent` constructor.
5+
- Added an optional parameter `data` to the `Event.exception` constructor.
46

57
## 6.1.2
68

pkgs/unified_analytics/lib/src/constants.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const int kMaxLogFileSize = 25 * (1 << 20);
8787
const String kLogFileName = 'dart-flutter-telemetry.log';
8888

8989
/// The current version of the package, should be in line with pubspec version.
90-
const String kPackageVersion = '6.1.3-wip';
90+
const String kPackageVersion = '6.1.3';
9191

9292
/// The minimum length for a session.
9393
const int kSessionDurationMinutes = 30;

pkgs/unified_analytics/lib/src/event.dart

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ final class Event {
378378
String? isExternalBuild,
379379
String? isEmbedded,
380380
String? ideLaunchedFeature,
381+
String? isWasm,
381382

382383
// PerformanceScreenMetrics
383384
int? uiDurationMicros,
@@ -419,6 +420,7 @@ final class Event {
419420
if (isEmbedded != null) 'isEmbedded': isEmbedded,
420421
if (ideLaunchedFeature != null)
421422
'ideLaunchedFeature': ideLaunchedFeature,
423+
if (isWasm != null) 'isWasm': isWasm,
422424

423425
// PerformanceScreenMetrics
424426
if (uiDurationMicros != null) 'uiDurationMicros': uiDurationMicros,
@@ -480,9 +482,15 @@ final class Event {
480482
/// exception that we want to log.
481483
///
482484
/// [exception] - string representation of the exception that occured.
483-
Event.exception({required String exception})
484-
: eventName = DashEvent.exception,
485-
eventData = {'exception': exception};
485+
/// [data] - optional structured data to include with the exception event.
486+
Event.exception({
487+
required String exception,
488+
Map<String, Object?> data = const <String, Object?>{},
489+
}) : eventName = DashEvent.exception,
490+
eventData = {
491+
'exception': exception,
492+
...data,
493+
};
486494

487495
/// Event that is emitted from the flutter tool when a build invocation
488496
/// has been run by the user.

pkgs/unified_analytics/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: >-
44
to Google Analytics.
55
# When updating this, keep the version consistent with the changelog and the
66
# value in lib/src/constants.dart.
7-
version: 6.1.3-wip
7+
version: 6.1.3
88
repository: https://github.com/dart-lang/tools/tree/main/pkgs/unified_analytics
99

1010
environment:

pkgs/unified_analytics/test/event_test.dart

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,14 +429,19 @@ void main() {
429429
});
430430

431431
test('Event.exception constructed', () {
432-
Event generateEvent() => Event.exception(exception: 'exception');
432+
Event generateEvent() => Event.exception(
433+
exception: 'exception',
434+
data: {'foo': 'bar', 'baz': 1},
435+
);
433436

434437
final constructedEvent = generateEvent();
435438

436439
expect(generateEvent, returnsNormally);
437440
expect(constructedEvent.eventName, DashEvent.exception);
438441
expect(constructedEvent.eventData['exception'], 'exception');
439-
expect(constructedEvent.eventData.length, 1);
442+
expect(constructedEvent.eventData['foo'], 'bar');
443+
expect(constructedEvent.eventData['baz'], 1);
444+
expect(constructedEvent.eventData.length, 3);
440445
});
441446

442447
test('Event.timing constructed', () {
@@ -570,6 +575,7 @@ void main() {
570575
isExternalBuild: 'isExternalBuild',
571576
isEmbedded: 'isEmbedded',
572577
ideLaunchedFeature: 'ideLaunchedFeature',
578+
isWasm: 'true',
573579
uiDurationMicros: 123,
574580
rasterDurationMicros: 123,
575581
shaderCompilationDurationMicros: 123,
@@ -603,6 +609,8 @@ void main() {
603609
expect(constructedEvent.eventData['isEmbedded'], 'isEmbedded');
604610
expect(
605611
constructedEvent.eventData['ideLaunchedFeature'], 'ideLaunchedFeature');
612+
expect(constructedEvent.eventData['isWasm'], 'true');
613+
606614
expect(constructedEvent.eventData['uiDurationMicros'], 123);
607615
expect(constructedEvent.eventData['rasterDurationMicros'], 123);
608616
expect(constructedEvent.eventData['shaderCompilationDurationMicros'], 123);
@@ -615,7 +623,7 @@ void main() {
615623
expect(constructedEvent.eventData['rootSetCount'], 123);
616624
expect(constructedEvent.eventData['rowCount'], 123);
617625
expect(constructedEvent.eventData['inspectorTreeControllerId'], 123);
618-
expect(constructedEvent.eventData.length, 27);
626+
expect(constructedEvent.eventData.length, 28);
619627
});
620628

621629
test('Confirm all constructors were checked', () {

0 commit comments

Comments
 (0)