Skip to content

Commit 5fe6ee6

Browse files
Add data about workspaces to Dart Analysis Server analytics (#2222)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 8a63538 commit 5fe6ee6

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

pkgs/unified_analytics/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 8.0.7
2+
- Added optional fields `contextWorkspaceType` and `numberOfPackagesInWorkspace`
3+
to `Event.contextStructure` for workspace and packages distribution from the
4+
Dart Analysis Server.
5+
- Removed `Event.contextStructure` optional fields `contextsFromBothFiles`,
6+
`contextsFromOptionsFiles`,`contextsFromPackagesFiles`,`contextsWithoutFiles`.
7+
18
## 8.0.6
29
- Added `Event.analysisStatistics` for events from Dart Analysis Server, about analysis.
310

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.6';
90+
const String kPackageVersion = '8.0.7';
9191

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

pkgs/unified_analytics/lib/src/event.dart

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -350,17 +350,14 @@ final class Event {
350350
/// [libraryCycleLineCounts] - json encoded percentile values indicating the
351351
/// number of lines of code in all of the files in a single library cycle.
352352
///
353-
/// [contextsFromBothFiles] - the number of contexts that were created because
354-
/// of both a package config and an analysis options file.
355-
///
356-
/// [contextsFromOptionsFiles] - the number of contexts that were created
357-
/// because of an analysis options file.
358-
///
359-
/// [contextsFromPackagesFiles] - the number of contexts that were created
360-
/// because of a package config file.
361-
///
362-
/// [contextsWithoutFiles] - the number of contexts that were created because
363-
/// of the lack of either a package config or an analysis options file.
353+
/// [contextWorkspaceType] - json encoded list with the total number of
354+
/// workspaces of each type for all of the contexts:
355+
/// - index 0: Blaze, GN or other workspace count
356+
/// - index 1: Package workspace count
357+
/// - index 2: Pub workspace count
358+
///
359+
/// [numberOfPackagesInWorkspace] - json encoded percentile values for the
360+
/// number of packages in the Pub workspaces.
364361
Event.contextStructure({
365362
required int immediateFileCount,
366363
required int immediateFileLineCount,
@@ -371,10 +368,8 @@ final class Event {
371368
required int transitiveFileUniqueLineCount,
372369
String libraryCycleLibraryCounts = '',
373370
String libraryCycleLineCounts = '',
374-
int contextsFromBothFiles = 0,
375-
int contextsFromOptionsFiles = 0,
376-
int contextsFromPackagesFiles = 0,
377-
int contextsWithoutFiles = 0,
371+
String contextWorkspaceType = '',
372+
String numberOfPackagesInWorkspace = '',
378373
}) : this._(
379374
eventName: DashEvent.contextStructure,
380375
eventData: {
@@ -387,10 +382,8 @@ final class Event {
387382
'transitiveFileUniqueLineCount': transitiveFileUniqueLineCount,
388383
'libraryCycleLibraryCounts': libraryCycleLibraryCounts,
389384
'libraryCycleLineCounts': libraryCycleLineCounts,
390-
'contextsFromBothFiles': contextsFromBothFiles,
391-
'contextsFromOptionsFiles': contextsFromOptionsFiles,
392-
'contextsFromPackagesFiles': contextsFromPackagesFiles,
393-
'contextsWithoutFiles': contextsWithoutFiles,
385+
'contextWorkspaceType': contextWorkspaceType,
386+
'numberOfPackagesInWorkspace': numberOfPackagesInWorkspace,
394387
},
395388
);
396389

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.6
8+
version: 8.0.7
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: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ void main() {
106106
transitiveFileUniqueLineCount: 7,
107107
libraryCycleLibraryCounts: 'a',
108108
libraryCycleLineCounts: 'b',
109+
contextWorkspaceType: '[0,1,2]',
110+
numberOfPackagesInWorkspace: '32',
109111
);
110112

111113
final constructedEvent = generateEvent();
@@ -121,11 +123,9 @@ void main() {
121123
expect(constructedEvent.eventData['transitiveFileUniqueLineCount'], 7);
122124
expect(constructedEvent.eventData['libraryCycleLibraryCounts'], 'a');
123125
expect(constructedEvent.eventData['libraryCycleLineCounts'], 'b');
124-
expect(constructedEvent.eventData['contextsFromBothFiles'], 0);
125-
expect(constructedEvent.eventData['contextsFromOptionsFiles'], 0);
126-
expect(constructedEvent.eventData['contextsFromPackagesFiles'], 0);
127-
expect(constructedEvent.eventData['contextsWithoutFiles'], 0);
128-
expect(constructedEvent.eventData.length, 13);
126+
expect(constructedEvent.eventData['contextWorkspaceType'], '[0,1,2]');
127+
expect(constructedEvent.eventData['numberOfPackagesInWorkspace'], '32');
128+
expect(constructedEvent.eventData.length, 11);
129129
});
130130

131131
test('Event.dartCliCommandExecuted constructed', () {

0 commit comments

Comments
 (0)