Skip to content

Commit e33ae5a

Browse files
committed
Initialize analytics metrics before framework initialization
1 parent fb3986f commit e33ae5a

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

packages/devtools_app/lib/initialization.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
44

5+
import 'dart:async';
6+
57
import 'package:devtools_app_shared/utils.dart';
68
import 'package:flutter/material.dart';
79
import 'package:flutter_web_plugins/url_strategy.dart';
810

911
import 'src/app.dart';
1012
import 'src/framework/framework_core.dart';
1113
import 'src/screens/debugger/syntax_highlighter.dart';
14+
import 'src/shared/analytics/analytics.dart' as ga;
1215
import 'src/shared/analytics/analytics_controller.dart';
1316
import 'src/shared/config_specific/logger/logger_helpers.dart';
1417
import 'src/shared/feature_flags.dart';
@@ -73,6 +76,11 @@ Future<void> initializeDevTools({
7376
enableExperiments: shouldEnableExperiments,
7477
);
7578

79+
// Initialize analytics metrics before initializing the framework so that any
80+
// analytics events include the expected metadata.
81+
// TODO(kenz): consider making the dimensions that need initialization `late`
82+
// so that they can be initialized on first access rather than manually.
83+
unawaited(ga.setupDimensions());
7684
await FrameworkCore.init();
7785
}
7886

packages/devtools_app/lib/src/app.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import 'screens/provider/provider_screen.dart';
4545
import 'screens/vm_developer/vm_developer_tools_controller.dart';
4646
import 'screens/vm_developer/vm_developer_tools_screen.dart';
4747
import 'service/service_extension_widgets.dart';
48-
import 'shared/analytics/analytics.dart' as ga;
4948
import 'shared/analytics/analytics_controller.dart';
5049
import 'shared/feature_flags.dart';
5150
import 'shared/framework/framework_controller.dart';
@@ -168,8 +167,6 @@ class DevToolsAppState extends State<DevToolsApp> with AutoDisposeMixin {
168167
// unawaited(BrowserContextMenu.disableContextMenu());
169168
// }
170169

171-
unawaited(ga.setupDimensions());
172-
173170
void clearRoutesAndSetState() {
174171
setState(() {
175172
_clearCachedRoutes();

0 commit comments

Comments
 (0)