Skip to content

Commit

Permalink
Added dartCliCommandExecuted and pubGet events (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkonyi authored Aug 16, 2023
1 parent 295ff92 commit 2be6c2e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 4 deletions.
12 changes: 12 additions & 0 deletions pkgs/unified_analytics/lib/src/enums.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ enum DashEvent {
description: 'Survey shown to the user',
),

// Events for the Dart CLI
dartCliCommandExecuted(
label: 'dart_cli_command_executed',
description: 'Information about the execution of a Dart CLI command',
toolOwner: DashTool.dartTool,
),
pubGet(
label: 'pub_get',
description: 'Pub package resolution details',
toolOwner: DashTool.dartTool,
),

// Events for flutter_tools
hotReloadTime(
label: 'hot_reload_time',
Expand Down
46 changes: 42 additions & 4 deletions pkgs/unified_analytics/lib/src/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,48 @@ final class Event {
: eventName = DashEvent.analyticsCollectionEnabled,
eventData = {'status': status};

/// Event that is emitted when a Dart CLI command has been executed.
///
/// [name] - the name of the command that was executed
///
/// [enabledExperiments] - a set of Dart language experiments enabled when
/// running the command.
///
/// [exitCode] - the process exit code set as a result of running the command.
Event.dartCliCommandExecuted({
required String name,
required String enabledExperiments,
int? exitCode,
}) : eventName = DashEvent.dartCliCommandExecuted,
eventData = {
'name': name,
'enabledExperiments': enabledExperiments,
if (exitCode != null) 'exitCode': exitCode,
};

/// Event that is emitted when `pub get` is run.
///
/// [packageName] - the name of the package that was resolved
///
/// [version] - the resolved, canonicalized package version
///
/// [dependencyKind] - the kind of dependency that resulted in this package
/// being resolved (e.g., direct, transitive, or dev dependencies).
Event.pubGet({
required String packageName,
required String version,
required String dependencyType,
}) : eventName = DashEvent.pubGet,
eventData = {
'packageName': packageName,
'version': version,
'dependencyType': dependencyType,
};

Event.hotReloadTime({required int timeMs})
: eventName = DashEvent.hotReloadTime,
eventData = {'timeMs': timeMs};

/// Event that is emitted periodically to report the performance of the
/// analysis server's handling of a specific kind of notification from the
/// client.
Expand Down Expand Up @@ -186,10 +228,6 @@ final class Event {
'transitiveFileUniqueLineCount': transitiveFileUniqueLineCount,
};

Event.hotReloadTime({required int timeMs})
: eventName = DashEvent.hotReloadTime,
eventData = {'timeMs': timeMs};

/// Event that is emitted periodically to report the number of times each lint
/// has been enabled.
///
Expand Down

0 comments on commit 2be6c2e

Please sign in to comment.