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

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

Issue 2963323002: Add analytics to analyzer-cli and analysis server. (Closed)
Patch Set: update from review comments Created 3 years, 5 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
« no previous file with comments | « pkg/analysis_server/BUILD.gn ('k') | pkg/analysis_server/lib/src/domain_analysis.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..38f0cfbf9ee8f71d19608abf118ae394f644c25a 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(() {
@@ -1043,16 +1053,30 @@ class AnalysisServer {
}
}
+/**
+ * Various IDE options.
+ */
class AnalysisServerOptions {
bool useAnalysisHighlight2 = false;
+ bool enableVerboseFlutterCompletions = false;
+
String fileReadMode = 'as-is';
String newAnalysisDriverLog;
String clientId;
String clientVersion;
- // IDE options
- bool enableVerboseFlutterCompletions = false;
+ /**
+ * The analytics instance; note, this object can be `null`, and should be
+ * 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;
}
/**
« no previous file with comments | « pkg/analysis_server/BUILD.gn ('k') | pkg/analysis_server/lib/src/domain_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698