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

Side by Side Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 2963323002: Add analytics to analyzer-cli and analysis server. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:core'; 7 import 'dart:core';
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 import 'dart:math' show max; 9 import 'dart:math' show max;
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 import 'package:analyzer/src/generated/sdk.dart'; 54 import 'package:analyzer/src/generated/sdk.dart';
55 import 'package:analyzer/src/generated/source.dart'; 55 import 'package:analyzer/src/generated/source.dart';
56 import 'package:analyzer/src/generated/source_io.dart'; 56 import 'package:analyzer/src/generated/source_io.dart';
57 import 'package:analyzer/src/generated/utilities_general.dart'; 57 import 'package:analyzer/src/generated/utilities_general.dart';
58 import 'package:analyzer/src/util/glob.dart'; 58 import 'package:analyzer/src/util/glob.dart';
59 import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element; 59 import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element;
60 import 'package:front_end/src/base/performace_logger.dart'; 60 import 'package:front_end/src/base/performace_logger.dart';
61 import 'package:front_end/src/incremental/byte_store.dart'; 61 import 'package:front_end/src/incremental/byte_store.dart';
62 import 'package:front_end/src/incremental/file_byte_store.dart'; 62 import 'package:front_end/src/incremental/file_byte_store.dart';
63 import 'package:plugin/plugin.dart'; 63 import 'package:plugin/plugin.dart';
64 import 'package:telemetry/crash_reporting.dart';
65 import 'package:telemetry/telemetry.dart' as telemetry;
66 import 'package:usage/usage.dart';
64 import 'package:watcher/watcher.dart'; 67 import 'package:watcher/watcher.dart';
65 68
66 typedef void OptionUpdater(AnalysisOptionsImpl options); 69 typedef void OptionUpdater(AnalysisOptionsImpl options);
67 70
68 /** 71 /**
69 * Enum representing reasons why analysis might be done for a given file. 72 * Enum representing reasons why analysis might be done for a given file.
70 */ 73 */
71 class AnalysisDoneReason { 74 class AnalysisDoneReason {
72 /** 75 /**
73 * Analysis of the file completed successfully. 76 * Analysis of the file completed successfully.
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 stackTrace = StackTrace.current; 774 stackTrace = StackTrace.current;
772 buffer.writeln(); 775 buffer.writeln();
773 buffer.write(stackTrace); 776 buffer.write(stackTrace);
774 } 777 }
775 778
776 // send the notification 779 // send the notification
777 channel.sendNotification( 780 channel.sendNotification(
778 new ServerErrorParams(fatal, message, buffer.toString()) 781 new ServerErrorParams(fatal, message, buffer.toString())
779 .toNotification()); 782 .toNotification());
780 783
784 // send to crash reporting
785 options.crashReportSender.sendReport(exception, stackTrace: stackTrace);
786
781 // remember the last few exceptions 787 // remember the last few exceptions
782 if (exception is CaughtException) { 788 if (exception is CaughtException) {
783 stackTrace ??= exception.stackTrace; 789 stackTrace ??= exception.stackTrace;
784 } 790 }
785 exceptions.add(new ServerException(message, exception, stackTrace, fatal)); 791 exceptions.add(new ServerException(message, exception, stackTrace, fatal));
786 } 792 }
787 793
788 /** 794 /**
789 * Send status notification to the client. The state of analysis is given by 795 * Send status notification to the client. The state of analysis is given by
790 * the [status] information. 796 * the [status] information.
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 } 1050 }
1045 1051
1046 class AnalysisServerOptions { 1052 class AnalysisServerOptions {
1047 bool useAnalysisHighlight2 = false; 1053 bool useAnalysisHighlight2 = false;
1048 String fileReadMode = 'as-is'; 1054 String fileReadMode = 'as-is';
1049 String newAnalysisDriverLog; 1055 String newAnalysisDriverLog;
1050 1056
1051 String clientId; 1057 String clientId;
1052 String clientVersion; 1058 String clientVersion;
1053 1059
1060 telemetry.Analytics analytics;
1061 CrashReportSender crashReportSender;
1062
1054 // IDE options 1063 // IDE options
1055 bool enableVerboseFlutterCompletions = false; 1064 bool enableVerboseFlutterCompletions = false;
1065
1066 void addMocks() {
1067 analytics = new AnalyticsMock()..enabled = false;
1068 crashReportSender = new CrashReportSender('mock-crash-id', analytics);
1069 }
1056 } 1070 }
1057 1071
1058 /** 1072 /**
1059 * A [PriorityChangeEvent] indicates the set the priority files has changed. 1073 * A [PriorityChangeEvent] indicates the set the priority files has changed.
1060 */ 1074 */
1061 class PriorityChangeEvent { 1075 class PriorityChangeEvent {
1062 final Source firstSource; 1076 final Source firstSource;
1063 1077
1064 PriorityChangeEvent(this.firstSource); 1078 PriorityChangeEvent(this.firstSource);
1065 } 1079 }
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 /** 1479 /**
1466 * The [PerformanceTag] for time spent in server request handlers. 1480 * The [PerformanceTag] for time spent in server request handlers.
1467 */ 1481 */
1468 static PerformanceTag serverRequests = server.createChild('requests'); 1482 static PerformanceTag serverRequests = server.createChild('requests');
1469 1483
1470 /** 1484 /**
1471 * The [PerformanceTag] for time spent in split store microtasks. 1485 * The [PerformanceTag] for time spent in split store microtasks.
1472 */ 1486 */
1473 static PerformanceTag splitStore = new PerformanceTag('splitStore'); 1487 static PerformanceTag splitStore = new PerformanceTag('splitStore');
1474 } 1488 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/domain_analysis.dart » ('j') | pkg/analysis_server/lib/src/domain_analysis.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698