Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 2963323002: Add analytics to analyzer-cli and analysis server. (Closed)
Patch Set: suppress analytics for integration tests; update the gn files Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 922321474eca22eac1d21a0f19d1fec3c92c6b43..fb1e5cb3a39c613e7de0e45c5893aefc80a18178 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -61,6 +61,9 @@ import 'package:front_end/src/base/performace_logger.dart';
import 'package:front_end/src/incremental/byte_store.dart';
import 'package:front_end/src/incremental/file_byte_store.dart';
import 'package:plugin/plugin.dart';
+import 'package:telemetry/crash_reporting.dart';
+import 'package:telemetry/telemetry.dart' as telemetry;
+import 'package:usage/usage.dart';
import 'package:watcher/watcher.dart';
typedef void OptionUpdater(AnalysisOptionsImpl options);
@@ -778,6 +781,9 @@ class AnalysisServer {
new ServerErrorParams(fatal, message, buffer.toString())
.toNotification());
+ // send to crash reporting
+ options.crashReportSender.sendReport(exception, stackTrace: stackTrace);
+
// remember the last few exceptions
if (exception is CaughtException) {
stackTrace ??= exception.stackTrace;
@@ -904,14 +910,18 @@ class AnalysisServer {
return contextManager.isInAnalysisRoot(file);
}
- void shutdown() {
+ Future shutdown() async {
scheglov 2017/06/30 23:36:29 Future<Null>
devoncarew 2017/07/01 22:18:04 Done.
running = false;
// Defer closing the channel and shutting down the instrumentation server so
// that the shutdown response can be sent and logged.
- new Future(() {
+ await new Future(() {
Brian Wilkerson 2017/06/30 22:52:17 We don't currently wait. Are you sure we should?
devoncarew 2017/07/01 22:18:04 I've removed the await (and added the ability to c
instrumentationService.shutdown();
channel.close();
});
+
+ // TODO(devoncarew): Call exit() explicitly?
+ await options.analytics
+ .waitForLastPing(timeout: new Duration(milliseconds: 200));
}
/**
@@ -1051,8 +1061,16 @@ class AnalysisServerOptions {
String clientId;
String clientVersion;
+ telemetry.Analytics analytics;
+ CrashReportSender crashReportSender;
+
// IDE options
bool enableVerboseFlutterCompletions = false;
+
+ void addMocks() {
scheglov 2017/06/30 23:36:29 Do we create and assign these objects just to avoi
devoncarew 2017/07/01 22:18:04 I removed this method, and instead had all the pla
+ analytics = new AnalyticsMock()..enabled = false;
+ crashReportSender = new CrashReportSender('mock-crash-id', analytics);
+ }
}
/**

Powered by Google App Engine
This is Rietveld 408576698