Example #1
0
 public static void LogProcessActiveFileDocument(CountLogAggregator <object> logAggregator, Guid _, bool processed)
 {
     if (processed)
     {
         logAggregator.IncreaseCount(ActiveFileProcessDocument);
     }
     else
     {
         logAggregator.IncreaseCount(ActiveFileProcessDocumentCancellation);
     }
 }
Example #2
0
        public static void LogProcessProject(CountLogAggregator <object> logAggregator, Guid projectId, bool processed)
        {
            if (processed)
            {
                logAggregator.IncreaseCount(ProcessProject);
            }
            else
            {
                logAggregator.IncreaseCount(ProcessProjectCancellation);
            }

            logAggregator.IncreaseCount(ValueTuple.Create(ProcessProject, projectId));
        }
Example #3
0
        public static void LogWorkCoordinatorShutdown(int correlationId, CountLogAggregator <WorkspaceChangeKind> logAggregator)
        {
            Logger.Log(FunctionId.WorkCoordinator_Shutdown, KeyValueLogMessage.Create(m =>
            {
                m[Id] = correlationId;

                foreach (var kv in logAggregator)
                {
                    var change = kv.Key.ToString();
                    m[change]  = kv.Value.GetCount();
                }
            }));
        }
Example #4
0
    public RequestTelemetryLogger(string serverTypeName)
    {
        _serverTypeName            = serverTypeName;
        _requestCounters           = new();
        _findDocumentResults       = new();
        _usedForkedSolutionCounter = new();

        // Buckets queued duration into 10ms buckets with the last bucket starting at 1000ms.
        // Queue times are relatively short and fall under 50ms, so tracking past 1000ms is not useful.
        _queuedDurationLogAggregator = new HistogramLogAggregator <string>(bucketSize: 10, maxBucketValue: 1000);

        // Since this is a log based histogram, these are appropriate bucket sizes for the log data.
        // A bucket at 1 corresponds to ~26ms, while the max bucket value corresponds to ~17minutes
        _requestDurationLogAggregator = new HistogramLogAggregator <string>(bucketSize: 1, maxBucketValue: 40);
    }
Example #5
0
        public static void LogWorkItemEnqueue(
            CountLogAggregator <object> logAggregator, string language, DocumentId?documentId, InvocationReasons reasons, bool lowPriority, SyntaxPath?activeMember, bool added)
        {
            logAggregator.IncreaseCount(language);
            logAggregator.IncreaseCount(added ? NewWorkItem : UpdateWorkItem);

            if (documentId != null)
            {
                logAggregator.IncreaseCount(activeMember == null ? TopLevel : MemberLevel);

                if (lowPriority)
                {
                    logAggregator.IncreaseCount(LowerPriority);
                    logAggregator.IncreaseCount(ValueTuple.Create(LowerPriority, documentId.Id));
                }
            }

            foreach (var reason in reasons)
            {
                logAggregator.IncreaseCount(reason);
            }
        }
Example #6
0
 public static void LogProcessProjectNotExist(CountLogAggregator <object> logAggregator)
 => logAggregator.IncreaseCount(ProjectNotExist);
Example #7
0
 public static void LogProcessOpenDocument(CountLogAggregator <object> logAggregator, Guid documentId)
 {
     logAggregator.IncreaseCount(OpenDocument);
     logAggregator.IncreaseCount(ValueTuple.Create(OpenDocument, documentId));
 }
Example #8
0
        public static void LogIncrementalAnalyzerProcessorStatistics(int correlationId, Solution solution, CountLogAggregator <object> logAggregator, ImmutableArray <IIncrementalAnalyzer> analyzers)
        {
            Logger.Log(FunctionId.IncrementalAnalyzerProcessor_Shutdown, KeyValueLogMessage.Create(m =>
            {
                var solutionHash = GetSolutionHash(solution);

                m[Id]           = correlationId;
                m[SolutionHash] = solutionHash.ToString();

                var statMap = new Dictionary <string, List <int> >();
                foreach (var(key, counter) in logAggregator)
                {
                    if (key is string stringKey)
                    {
                        m[stringKey] = counter.GetCount();
                    }
                    else if (key is ValueTuple <string, Guid> propertyNameAndId)
                    {
                        var list = statMap.GetOrAdd(propertyNameAndId.Item1, _ => new List <int>());
                        list.Add(counter.GetCount());
                    }
                    else
                    {
                        throw ExceptionUtilities.Unreachable;
                    }
                }

                foreach (var(propertyName, propertyValues) in statMap)
                {
                    var result = StatisticResult.FromList(propertyValues);

                    m[CreateProperty(propertyName, Max)]    = result.Maximum;
                    m[CreateProperty(propertyName, Min)]    = result.Minimum;
                    m[CreateProperty(propertyName, Median)] = result.Median !.Value;
                    m[CreateProperty(propertyName, Mean)]   = result.Mean;
                    m[CreateProperty(propertyName, Mode)]   = result.Mode !.Value;
                    m[CreateProperty(propertyName, Range)]  = result.Range;
                    m[CreateProperty(propertyName, Count)]  = result.Count;
                }
            }));

            foreach (var analyzer in analyzers)
            {
                analyzer.LogAnalyzerCountSummary();
            }
        }
Example #9
0
 public static void LogResetStates(CountLogAggregator <object> logAggregator)
 => logAggregator.IncreaseCount(ResetStates);
Example #10
0
 public static void LogHigherPriority(CountLogAggregator <object> logAggregator, Guid documentId)
 {
     logAggregator.IncreaseCount(HigherPriority);
     logAggregator.IncreaseCount(ValueTuple.Create(HigherPriority, documentId));
 }
Example #11
0
 public static void LogWorkItemEnqueue(CountLogAggregator <object> logAggregator, ProjectId _)
 => logAggregator.IncreaseCount(ProjectEnqueue);
Example #12
0
 public static void LogActiveFileEnqueue(CountLogAggregator <object> logAggregator)
 => logAggregator.IncreaseCount(ActiveFileEnqueue);
Example #13
0
 public static void LogGlobalOperation(CountLogAggregator <object> logAggregator)
 => logAggregator.IncreaseCount(GlobalOperation);
Example #14
0
 public static void LogWorkspaceEvent(CountLogAggregator <WorkspaceChangeKind> logAggregator, WorkspaceChangeKind kind)
 => logAggregator.IncreaseCount(kind);
Example #15
0
 private void ResetLogAggregator()
 => _logAggregator = new CountLogAggregator <object>();