Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event Constructor added for devtools event #258

Merged
merged 9 commits into from
Apr 22, 2024

Conversation

eliasyishak
Copy link
Contributor

@eliasyishak eliasyishak commented Mar 27, 2024

Part of tracker issue:

Devtools uses one large data class for all of their events. This PR is adding that data class as a named constructor under Event called Event.devtoolsAction

The singular data class can be found here in devtools source code.


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

@eliasyishak eliasyishak changed the title Constructor added for the one devtools event Event Constructor added for devtools event Mar 27, 2024
Comment on lines +359 to +448
/// Event that is sent from devtools for various different actions as
/// indicated by the [eventCategory].
Event.devtoolsEvent({
required String eventCategory,
required String label,
required int value,

// Defaulted values
bool userInitiatedInteraction = true,

// Optional parameters
String? g3Username,
String? userApp,
String? userBuild,
String? userPlatform,
String? devtoolsPlatform,
String? devtoolsChrome,
String? devtoolsVersion,
String? ideLaunched,
String? isExternalBuild,
String? isEmbedded,
String? ideLaunchedFeature,

// PerformanceScreenMetrics
int? uiDurationMicros,
int? rasterDurationMicros,
int? shaderCompilationDurationMicros,
int? traceEventCount,

// ProfilerScreenMetrics
int? cpuSampleCount,
int? cpuStackDepth,

// MemoryScreenMetrics
int? heapDiffObjectsBefore,
int? heapDiffObjectsAfter,
int? heapObjectsTotal,

// InspectorScreenMetrics
int? rootSetCount,
int? rowCount,
int? inspectorTreeControllerId,
}) : eventName = DashEvent.devtoolsEvent,
eventData = {
'eventCategory': eventCategory,
'label': label,
'value': value,

'userInitiatedInteraction': userInitiatedInteraction,

// Optional parameters
if (g3Username != null) 'g3Username': g3Username,
if (userApp != null) 'userApp': userApp,
if (userBuild != null) 'userBuild': userBuild,
if (userPlatform != null) 'userPlatform': userPlatform,
if (devtoolsPlatform != null) 'devtoolsPlatform': devtoolsPlatform,
if (devtoolsChrome != null) 'devtoolsChrome': devtoolsChrome,
if (devtoolsVersion != null) 'devtoolsVersion': devtoolsVersion,
if (ideLaunched != null) 'ideLaunched': ideLaunched,
if (isExternalBuild != null) 'isExternalBuild': isExternalBuild,
if (isEmbedded != null) 'isEmbedded': isEmbedded,
if (ideLaunchedFeature != null)
'ideLaunchedFeature': ideLaunchedFeature,

// PerformanceScreenMetrics
if (uiDurationMicros != null) 'uiDurationMicros': uiDurationMicros,
if (rasterDurationMicros != null)
'rasterDurationMicros': rasterDurationMicros,
if (shaderCompilationDurationMicros != null)
'shaderCompilationDurationMicros': shaderCompilationDurationMicros,
if (traceEventCount != null) 'traceEventCount': traceEventCount,

// ProfilerScreenMetrics
if (cpuSampleCount != null) 'cpuSampleCount': cpuSampleCount,
if (cpuStackDepth != null) 'cpuStackDepth': cpuStackDepth,

// MemoryScreenMetrics
if (heapDiffObjectsBefore != null)
'heapDiffObjectsBefore': heapDiffObjectsBefore,
if (heapDiffObjectsAfter != null)
'heapDiffObjectsAfter': heapDiffObjectsAfter,
if (heapObjectsTotal != null) 'heapObjectsTotal': heapObjectsTotal,

// InspectorScreenMetrics
if (rootSetCount != null) 'rootSetCount': rootSetCount,
if (rowCount != null) 'rowCount': rowCount,
if (inspectorTreeControllerId != null)
'inspectorTreeControllerId': inspectorTreeControllerId,
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this look like everything is being captured from the _gtagEvent function?

Referenced from here: https://github.com/eliasyishak/devtools/blob/migrate-select-event/packages/devtools_app/lib/src/shared/analytics/_analytics_web.dart#L196-L254

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have included all of the fields from the linked function above, except for sent_to and flutter_client_id and that is because we have the "send to" for GA4 within the package and the client id is managed by the package and added to the payload on send requests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Package publishing

Package Version Status Publish tag (post-merge)
package:unified_analytics 6.1.0 ready to publish unified_analytics-v6.1.0
package:cli_config 0.2.0 already published at pub.dev
package:extension_discovery 2.0.1-wip WIP (no publish necessary)
package:graphs 2.3.2-wip WIP (no publish necessary)

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

@eliasyishak eliasyishak merged commit 3e21ae9 into dart-lang:main Apr 22, 2024
6 checks passed
@eliasyishak eliasyishak deleted the event-for-devtools branch April 22, 2024 16:56
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Apr 22, 2024
Revisions updated by `dart tools/rev_sdk_deps.dart`.

benchmark_harness (https://github.com/dart-lang/benchmark_harness/compare/d23112a..aa139fd):
  aa139fd  2024-04-18  William Hesse  Add support for running perftools to use hardware performance counters when benchmarking. (dart-lang/benchmark_harness#98)

dartdoc (https://github.com/dart-lang/dartdoc/compare/592694e..1ae5b4c):
  1ae5b4c0  2024-04-22  dependabot[bot]  Bump actions/upload-artifact from 4.3.1 to 4.3.3 (dart-lang/dartdoc#3755)
  5934d2d6  2024-04-22  dependabot[bot]  Bump actions/checkout from 4.1.2 to 4.1.3 (dart-lang/dartdoc#3754)
  a9500f0d  2024-04-22  Sam Rawlins  Replace hasPrivateName/hasPublicName with one extension getter (dart-lang/dartdoc#3752)

tools (https://github.com/dart-lang/tools/compare/d86ea23..3e21ae9):
  3e21ae9  2024-04-22  Elias Yishak  `Event` Constructor added for devtools event (dart-lang/tools#258)

webdev (https://github.com/dart-lang/webdev/compare/3a10b76..d4f9f67):
  d4f9f672  2024-04-22  Devon Carew  remove the dep on package:uuid (dart-lang/webdev#2415)
  78555cdd  2024-04-18  Kevin Moore  FE server common: move from pkg:usage to pkg:uuid (dart-lang/webdev#2412)
  16dce1f2  2024-04-18  Elliott Brooks  Pin DCM to latest version (dart-lang/webdev#2410)
  b0494fb5  2024-04-18  Elliott Brooks  Catch errors when calculating frames in the stack trace (dart-lang/webdev#2408)

Change-Id: I1d206665e33e5936f4a5bf93e029a7290803895d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364021
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants