Skip to content

Commit 8c23de8

Browse files
authored
Add IDE, plugin info (#2379)
1 parent 7e118e1 commit 8c23de8

5 files changed

Lines changed: 56 additions & 5 deletions

File tree

pkgs/unified_analytics/CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
## 8.0.14
1+
## 8.0.15
2+
- Added IDE and plugin information to `Event.serverSession`.
23

3-
* Added HCPP related analytics to `Event.commandUsageValues`.
4+
## 8.0.14
5+
- Added HCPP related analytics to `Event.commandUsageValues`.
46

57
## 8.0.13
68
- Added `DashEnvVar` utilities for environment variable handling.

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

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

pkgs/unified_analytics/lib/src/event.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,19 +979,35 @@ final class Event {
979979
/// * [parameters] - the names of the parameters passed to the `initialize`
980980
/// request, or an empty string if the `initialize` request was not sent
981981
/// or if there were no parameters given.
982+
///
983+
/// * [ideName] - the name of the IDE, e.g. IntelliJ IDEA.
984+
///
985+
/// * [ideVersion] - the version of the IDE platform.
986+
///
987+
/// * [pluginName] - the name of the plugin, e.g. Dart.
988+
///
989+
/// * [pluginVersion] - the version of the plugin.
982990
Event.serverSession({
983991
required String clientId,
984992
required String clientVersion,
985993
required int duration,
986994
required String flags,
987995
required String parameters,
996+
String ideName = '',
997+
String ideVersion = '',
998+
String pluginName = '',
999+
String pluginVersion = '',
9881000
}) : this._(
9891001
eventName: DashEvent.serverSession,
9901002
eventData: {
9911003
'clientId': clientId,
9921004
'clientVersion': clientVersion,
9931005
'duration': duration,
9941006
'flags': flags,
1007+
'ideName': ideName,
1008+
'ideVersion': ideVersion,
1009+
'pluginName': pluginName,
1010+
'pluginVersion': pluginVersion,
9951011
'parameters': parameters,
9961012
},
9971013
);

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.14
8+
version: 8.0.15
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: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,40 @@ void main() {
346346
expect(constructedEvent.eventData['duration'], 5);
347347
expect(constructedEvent.eventData['flags'], 'flags');
348348
expect(constructedEvent.eventData['parameters'], 'parameters');
349-
expect(constructedEvent.eventData.length, 5);
349+
expect(constructedEvent.eventData['ideName'], '');
350+
expect(constructedEvent.eventData['ideVersion'], '');
351+
expect(constructedEvent.eventData['pluginName'], '');
352+
expect(constructedEvent.eventData['pluginVersion'], '');
353+
expect(constructedEvent.eventData.length, 9);
354+
});
355+
356+
test('Event.serverSession constructed with optional parameters', () {
357+
Event generateEvent() => Event.serverSession(
358+
clientId: 'clientId',
359+
clientVersion: 'clientVersion',
360+
duration: 5,
361+
flags: 'flags',
362+
parameters: 'parameters',
363+
ideName: 'ideName',
364+
ideVersion: 'ideVersion',
365+
pluginName: 'pluginName',
366+
pluginVersion: 'pluginVersion',
367+
);
368+
369+
final constructedEvent = generateEvent();
370+
371+
expect(generateEvent, returnsNormally);
372+
expect(constructedEvent.eventName, DashEvent.serverSession);
373+
expect(constructedEvent.eventData['clientId'], 'clientId');
374+
expect(constructedEvent.eventData['clientVersion'], 'clientVersion');
375+
expect(constructedEvent.eventData['duration'], 5);
376+
expect(constructedEvent.eventData['flags'], 'flags');
377+
expect(constructedEvent.eventData['parameters'], 'parameters');
378+
expect(constructedEvent.eventData['ideName'], 'ideName');
379+
expect(constructedEvent.eventData['ideVersion'], 'ideVersion');
380+
expect(constructedEvent.eventData['pluginName'], 'pluginName');
381+
expect(constructedEvent.eventData['pluginVersion'], 'pluginVersion');
382+
expect(constructedEvent.eventData.length, 9);
350383
});
351384

352385
test('Event.severityAdjustment constructed', () {

0 commit comments

Comments
 (0)