Skip to content

Commit

Permalink
Merge pull request #59694 from genlu/telemetry
Browse files Browse the repository at this point in the history
Add telemetry at async completion layer
  • Loading branch information
genlu authored Feb 24, 2022
2 parents a50a9a2 + f0d6642 commit f0bc164
Show file tree
Hide file tree
Showing 3 changed files with 246 additions and 180 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ private enum ActionInfo
CommitItemWithTargetTypeFilter,

GetDefaultsMatchTicks,

SourceInitializationTicks,
SourceGetContextCompletedTicks,
SourceGetContextCanceledTicks,

ItemManagerSortTicks,
ItemManagerUpdateCompletedTicks,
ItemManagerUpdateCanceledTicks,
}

internal static void LogImportCompletionGetContext(bool isBlocking, bool delayed)
Expand Down Expand Up @@ -89,6 +97,38 @@ internal static void LogSessionHasTargetTypeFilterEnabled() =>
internal static void LogGetDefaultsMatchTicksDataPoint(int count) =>
s_statisticLogAggregator.AddDataPoint((int)ActionInfo.GetDefaultsMatchTicks, count);

internal static void LogSourceInitializationTicksDataPoint(int count)
{
s_statisticLogAggregator.AddDataPoint((int)ActionInfo.SourceInitializationTicks, count);
s_histogramLogAggregator.IncreaseCount((int)ActionInfo.SourceInitializationTicks, count);
}

internal static void LogSourceGetContextTicksDataPoint(int count, bool isCanceled)
{
var key = isCanceled
? ActionInfo.SourceGetContextCanceledTicks
: ActionInfo.SourceGetContextCompletedTicks;

s_statisticLogAggregator.AddDataPoint((int)key, count);
s_histogramLogAggregator.IncreaseCount((int)key, count);
}

internal static void LogItemManagerSortTicksDataPoint(int count)
{
s_statisticLogAggregator.AddDataPoint((int)ActionInfo.ItemManagerSortTicks, count);
s_histogramLogAggregator.IncreaseCount((int)ActionInfo.ItemManagerSortTicks, count);
}

internal static void LogItemManagerUpdateDataPoint(int count, bool isCanceled)
{
var key = isCanceled
? ActionInfo.ItemManagerUpdateCanceledTicks
: ActionInfo.ItemManagerUpdateCompletedTicks;

s_statisticLogAggregator.AddDataPoint((int)key, count);
s_histogramLogAggregator.IncreaseCount((int)key, count);
}

internal static void ReportTelemetry()
{
Logger.Log(FunctionId.Intellisense_AsyncCompletion_Data, KeyValueLogMessage.Create(m =>
Expand Down
Loading

0 comments on commit f0bc164

Please sign in to comment.