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

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

Issue 2963323002: Add analytics to analyzer-cli and analysis server. (Closed)
Patch Set: dartfmt 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..15a20ea34c7495ffecb91c0792cac84a3997f878 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -61,6 +61,8 @@ 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:watcher/watcher.dart';
typedef void OptionUpdater(AnalysisOptionsImpl options);
@@ -778,6 +780,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,8 +909,13 @@ class AnalysisServer {
return contextManager.isInAnalysisRoot(file);
}
- void shutdown() {
+ Future<Null> shutdown() async {
running = false;
+
+ await options.analytics
+ ?.waitForLastPing(timeout: new Duration(milliseconds: 200));
+ options.analytics?.close();
+
// Defer closing the channel and shutting down the instrumentation server so
// that the shutdown response can be sent and logged.
new Future(() {
@@ -1051,6 +1061,14 @@ class AnalysisServerOptions {
String clientId;
String clientVersion;
+ /// The analytics instance; note, this object can be `null`, and should be
Brian Wilkerson 2017/07/02 15:54:26 Perhaps use a doc comment style consistent with ex
devoncarew 2017/07/04 02:35:48 Done.
+ /// accessed via a null-aware operator.
+ telemetry.Analytics analytics;
+
+ /// The crash report sender instance; note, this object can be `null`, and
+ /// should be accessed via a null-aware operator.
+ CrashReportSender crashReportSender;
+
// IDE options
Brian Wilkerson 2017/07/02 15:54:26 This should have been a doc comment (one disadvant
devoncarew 2017/07/04 02:35:48 Sure - moved to the AnalysisServerOptions class.
bool enableVerboseFlutterCompletions = false;
}

Powered by Google App Engine
This is Rietveld 408576698