public static void LogAnalyzerTypeCountSummary(int correlationId, DiagnosticLogAggregator logAggregator) { if (logAggregator == null) { return; } foreach (var kvp in logAggregator.AnalyzerInfoMap) { Logger.Log(FunctionId.DiagnosticAnalyzerDriver_AnalyzerTypeCount, KeyValueLogMessage.Create(m => { m[Id] = correlationId.ToString(); var ai = kvp.Value; bool hasTelemetry = ai.Telemetry; // we log analyzer name as it is, if telemetry is allowed if (hasTelemetry) { m[AnalyzerName] = ai.CLRType.FullName; } else { // if it is from third party, we use hashcode m[AnalyzerHashCode] = ComputeSha256Hash(ai.CLRType.FullName); } for (var i = 0; i < ai.Counts.Length; i++) { m[DiagnosticLogAggregator.AnalyzerTypes[i]] = ai.Counts[i].ToString(); } })); } }
public DiagnosticIncrementalAnalyzer(DiagnosticAnalyzerService owner, int correlationId, Workspace workspace, AnalyzerManager analyzerManager) { _owner = owner; _correlationId = correlationId; _memberRangeMap = new MemberRangeMap(); _analyzersAndState = new DiagnosticAnalyzersAndStates(this, workspace, analyzerManager); _executor = new AnalyzerExecutor(this); _diagnosticLogAggregator = new DiagnosticLogAggregator(_owner); }
public static void UpdateAnalyzerTypeCount(DiagnosticAnalyzer analyzer, AnalyzerActions analyzerActions, DiagnosticLogAggregator logAggregator) { if (analyzerActions == null || analyzer == null || logAggregator == null) { return; } logAggregator.UpdateAnalyzerTypeCount(analyzer, analyzerActions); }
internal override Action <Exception, DiagnosticAnalyzer, Diagnostic> GetOnAnalyzerException(ProjectId projectId, DiagnosticLogAggregator diagnosticLogAggregator) { return(_onAnalyzerException ?? base.GetOnAnalyzerException(projectId, diagnosticLogAggregator)); }
protected void ResetDiagnosticLogAggregator() { DiagnosticLogAggregator = new DiagnosticLogAggregator(Owner); }
// virtual for testing purposes. internal virtual Action <Exception, DiagnosticAnalyzer, Diagnostic> GetOnAnalyzerException(ProjectId projectId, DiagnosticLogAggregator diagnosticLogAggregator) { return((ex, analyzer, diagnostic) => { // Log telemetry, if analyzer supports telemetry. DiagnosticAnalyzerLogger.LogAnalyzerCrashCount(analyzer, ex, diagnosticLogAggregator, projectId); AnalyzerHelper.OnAnalyzerException_NoTelemetryLogging(ex, analyzer, diagnostic, _hostDiagnosticUpdateSource, projectId); }); }
public void LogAnalyzerCountSummary() { DiagnosticAnalyzerLogger.LogAnalyzerCrashCountSummary(_correlationId, _diagnosticLogAggregator); DiagnosticAnalyzerLogger.LogAnalyzerTypeCountSummary(_correlationId, _diagnosticLogAggregator); // reset the log aggregator _diagnosticLogAggregator = new DiagnosticLogAggregator(_owner); }
public static void LogAnalyzerTypeCountSummary(int correlationId, DiagnosticLogAggregator logAggregator) { if (logAggregator == null) { return; } foreach (var kvp in logAggregator.AnalyzerInfoMap) { Logger.Log(FunctionId.DiagnosticAnalyzerDriver_AnalyzerTypeCount, KeyValueLogMessage.Create(m => { m[Id] = correlationId; var analyzerInfo = kvp.Value; bool hasTelemetry = analyzerInfo.Telemetry; // we log analyzer name as it is, if telemetry is allowed if (hasTelemetry) { m[AnalyzerName] = analyzerInfo.CLRType.FullName; } else { // if it is from third party, we use hashcode m[AnalyzerHashCode] = ComputeSha256Hash(analyzerInfo.CLRType.FullName); } for (var i = 0; i < analyzerInfo.Counts.Length; i++) { m[DiagnosticLogAggregator.AnalyzerTypes[i]] = analyzerInfo.Counts[i]; } })); } }