Skip to content

Commit 2f4a524

Browse files
authored
[UA] Add success and label (#2328)
see : flutter/flutter#181559 (comment) <details> <summary>Contribution guidelines:</summary><br> - See our [contributor guide](https://github.com/dart-lang/.github/blob/main/CONTRIBUTING.md) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`. - Most changes should add an entry to the changelog and may need to [rev the pubspec package version](https://github.com/dart-lang/sdk/blob/main/docs/External-Package-Maintenance.md#making-a-change). - Changes to packages require [corresponding tests](https://github.com/dart-lang/.github/blob/main/CONTRIBUTING.md#Testing). Many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback. **Note**: The Dart team is trialing Gemini Code Assist. Don't take its comments as final Dart team feedback. Use the suggestions if they're helpful; otherwise, wait for a human reviewer. </details>
1 parent 7bb6d74 commit 2f4a524

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

pkgs/unified_analytics/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## 8.0.12-wip
1+
## 8.0.12
22
- Require Dart 3.10
3+
- Added `success` indicator and `label` to `Event.flutterTrackAndroidDependencies`
34

45
## 8.0.11
56
- Added `Event.flutterTrackAndroidDependencies` to track android dependencies.

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 = '8.0.12-wip';
90+
const String kPackageVersion = '8.0.12';
9191

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

pkgs/unified_analytics/lib/src/event.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,10 @@ final class Event {
733733

734734
/// Provides information about the android dependencies of a project.
735735
///
736+
/// * [success] - whether the build succeded.
737+
///
738+
/// * [label] - the error label if the build fails.
739+
///
736740
/// * [isModule] - whether the project is an add-to-app Flutter module.
737741
///
738742
/// * [agpVersion] - the Android Gradle plugin of the build target.
@@ -750,6 +754,8 @@ final class Event {
750754
///
751755
/// * [gradleVersion] - the Gradle version used by the build target.
752756
Event.flutterTrackAndroidDependencies({
757+
required bool success,
758+
String? label,
753759
bool? isModule,
754760
String? agpVersion,
755761
int? minSDK,
@@ -761,6 +767,8 @@ final class Event {
761767
}) : this._(
762768
eventName: DashEvent.flutterTrackAndroidDependencies,
763769
eventData: {
770+
'success': success,
771+
'label': ?label,
764772
'isModule': ?isModule,
765773
'agpVersion': ?agpVersion,
766774
'minSDK': ?minSDK,

pkgs/unified_analytics/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: >-
55
# LINT.IfChange
66
# When updating this, keep the version consistent with the changelog and the
77
# value in lib/src/constants.dart.
8-
version: 8.0.12-wip
8+
version: 8.0.12
99
# LINT.ThenChange(lib/src/constants.dart)
1010
repository: https://github.com/dart-lang/tools/tree/main/pkgs/unified_analytics
1111
issue_tracker: https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aunified_analytics

pkgs/unified_analytics/test/event_test.dart

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@ void main() {
539539
group('Event.flutterTrackAndroidDependencies', () {
540540
test('constructed', () {
541541
Event generateEvent() => Event.flutterTrackAndroidDependencies(
542+
success: true,
542543
isModule: true,
543544
agpVersion: '8.2.2',
544545
minSDK: 24,
@@ -556,6 +557,8 @@ void main() {
556557
constructedEvent.eventName,
557558
DashEvent.flutterTrackAndroidDependencies,
558559
);
560+
expect(constructedEvent.eventData['success'], isTrue);
561+
expect(constructedEvent.eventData['label'], isNull);
559562
expect(constructedEvent.eventData['isModule'], isTrue);
560563
expect(constructedEvent.eventData['agpVersion'], '8.2.2');
561564
expect(constructedEvent.eventData['minSDK'], 24);
@@ -564,11 +567,13 @@ void main() {
564567
expect(constructedEvent.eventData['jdkVersion'], 24);
565568
expect(constructedEvent.eventData['ndkVersion'], '28.0.13004108');
566569
expect(constructedEvent.eventData['gradleVersion'], '8.10.2');
567-
expect(constructedEvent.eventData.length, 8);
570+
expect(constructedEvent.eventData.length, 9);
568571
});
569572

570573
test('constructor arguments default to null if not specified', () {
571574
Event generateEvent() => Event.flutterTrackAndroidDependencies(
575+
success: false,
576+
label: 'failed to download gradle from ...',
572577
isModule: true,
573578
agpVersion: '8.2.2',
574579
targetSDK: 36,
@@ -583,6 +588,11 @@ void main() {
583588
constructedEvent.eventName,
584589
DashEvent.flutterTrackAndroidDependencies,
585590
);
591+
expect(constructedEvent.eventData['success'], isFalse);
592+
expect(
593+
constructedEvent.eventData['label'],
594+
'failed to download gradle from ...',
595+
);
586596
expect(constructedEvent.eventData['isModule'], isTrue);
587597
expect(constructedEvent.eventData['agpVersion'], '8.2.2');
588598
expect(constructedEvent.eventData['minSDK'], null);
@@ -591,7 +601,7 @@ void main() {
591601
expect(constructedEvent.eventData['jdkVersion'], 24);
592602
expect(constructedEvent.eventData['ndkVersion'], null);
593603
expect(constructedEvent.eventData['gradleVersion'], '8.10.2');
594-
expect(constructedEvent.eventData.length, 5);
604+
expect(constructedEvent.eventData.length, 7);
595605
});
596606
});
597607
test('Event.codeSizeAnalysis constructed', () {

0 commit comments

Comments
 (0)