Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add telemetry comments #156827

Merged
merged 4 commits into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ export const openNewSearchEditor =
}
}

telemetryService.publicLog2<{}, { owner: 'roblourens'; comment: 'TODO @roblourens' }>('searchEditor/openNewSearchEditor');
telemetryService.publicLog2<{},
{
owner: 'roblourens';
comment: 'Fired when a search editor is opened';
}>
('searchEditor/openNewSearchEditor');

const seedSearchStringFromSelection = _args.location === 'new' || configurationService.getValue<IEditorOptions>('editor').find!.seedSearchStringFromSelection;
const args: OpenSearchEditorArgs = { query: seedSearchStringFromSelection ? selected : undefined };
Expand Down Expand Up @@ -188,8 +193,13 @@ export const createEditorFromSearchResult =
const configurationService = accessor.get(IConfigurationService);
const sortOrder = configurationService.getValue<ISearchConfigurationProperties>('search').sortOrder;


telemetryService.publicLog2<{}, { owner: 'roblourens'; comment: 'TODO @roblourens' }>('searchEditor/createEditorFromSearchResult');
telemetryService.publicLog2<
{},
{
owner: 'roblourens';
comment: 'Fired when a search editor is opened from the search view';
}>
('searchEditor/createEditorFromSearchResult');

const labelFormatter = (uri: URI): string => labelService.getUriLabel(uri, { relative: true });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,13 @@ export class SearchEditorInput extends EditorInput {
override async saveAs(group: GroupIdentifier, options?: ITextFileSaveOptions): Promise<EditorInput | undefined> {
const path = await this.fileDialogService.pickFileToSave(await this.suggestFileName(), options?.availableFileSystems);
if (path) {
this.telemetryService.publicLog2<{}, { owner: 'roblourens'; comment: 'TODO @roblourens' }>('searchEditor/saveSearchResults');
this.telemetryService.publicLog2<
{},
{
owner: 'roblourens';
comment: 'Fired when a search editor is saved';
}>
('searchEditor/saveSearchResults');
const toWrite = await this.serializeForDisk();
if (await this.textFileService.create([{ resource: path, value: toWrite, options: { overwrite: true } }])) {
this.setDirty(false);
Expand Down
67 changes: 29 additions & 38 deletions src/vs/workbench/services/search/common/searchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,24 +283,22 @@ export class SearchService extends Disposable implements ISearchService {

type CachedSearchCompleteClassifcation = {
owner: 'roblourens';
comment: 'TODO @roblourens';
reason?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'TODO @roblourens' };
resultCount: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
workspaceFolderCount: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
type: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'TODO @roblourens' };
endToEndTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
sortingTime?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
cacheWasResolved: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'TODO @roblourens' };
cacheLookupTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
cacheFilterTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
cacheEntryCount: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
scheme: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'TODO @roblourens' };
comment: 'Fired when a file search is completed from previously cached results';
reason?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'Indicates which extension or UI feature triggered this search' };
resultCount: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The number of search results' };
workspaceFolderCount: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The number of folders in the workspace' };
endToEndTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The total search time' };
sortingTime?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The amount of time spent sorting results' };
cacheWasResolved: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'Whether the cache was already resolved when the search began' };
cacheLookupTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The amount of time spent looking up the cache to use for the search' };
cacheFilterTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The amount of time spent searching within the cache' };
cacheEntryCount: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The number of entries in the searched-in cache' };
scheme: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'The uri scheme of the folder searched in' };
};
type CachedSearchCompleteEvent = {
reason?: string;
resultCount: number;
workspaceFolderCount: number;
type: 'fileSearchProvider' | 'searchProcess';
endToEndTime: number;
sortingTime?: number;
cacheWasResolved: boolean;
Expand All @@ -313,7 +311,6 @@ export class SearchService extends Disposable implements ISearchService {
reason: query._reason,
resultCount: fileSearchStats.resultCount,
workspaceFolderCount: query.folderQueries.length,
type: fileSearchStats.type,
endToEndTime: endToEndTime,
sortingTime: fileSearchStats.sortingTime,
cacheWasResolved: cacheStats.cacheWasResolved,
Expand All @@ -327,25 +324,23 @@ export class SearchService extends Disposable implements ISearchService {

type SearchCompleteClassification = {
owner: 'roblourens';
comment: 'TODO @roblourens';
reason?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'TODO @roblourens' };
resultCount: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
workspaceFolderCount: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
type: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'TODO @roblourens' };
endToEndTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
sortingTime?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
fileWalkTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
directoriesWalked: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
filesWalked: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
cmdTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
cmdResultCount?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
scheme: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'TODO @roblourens' };
comment: 'Fired when a file search is completed';
reason?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'Indicates which extension or UI feature triggered this search' };
resultCount: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The number of search results' };
workspaceFolderCount: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The number of folders in the workspace' };
endToEndTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The total search time' };
sortingTime?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The amount of time spent sorting results' };
fileWalkTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The amount of time spent walking file system' };
directoriesWalked: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The number of directories walked' };
filesWalked: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The number of files walked' };
cmdTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The amount of time spent running the search command' };
cmdResultCount?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The number of results returned from the search command' };
scheme: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'The uri scheme of the folder searched in' };
};
type SearchCompleteEvent = {
reason?: string;
resultCount: number;
workspaceFolderCount: number;
type: 'fileSearchProvider' | 'searchProcess';
endToEndTime: number;
sortingTime?: number;
fileWalkTime: number;
Expand All @@ -361,7 +356,6 @@ export class SearchService extends Disposable implements ISearchService {
reason: query._reason,
resultCount: fileSearchStats.resultCount,
workspaceFolderCount: query.folderQueries.length,
type: fileSearchStats.type,
endToEndTime: endToEndTime,
sortingTime: fileSearchStats.sortingTime,
fileWalkTime: searchEngineStats.fileWalkTime,
Expand All @@ -386,29 +380,26 @@ export class SearchService extends Disposable implements ISearchService {

type TextSearchCompleteClassification = {
owner: 'roblourens';
comment: 'TODO @roblourens';
reason?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'TODO @roblourens' };
workspaceFolderCount: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
endToEndTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'TODO @roblourens' };
scheme: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'TODO @roblourens' };
error?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'TODO @roblourens' };
usePCRE2: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'TODO @roblourens' };
comment: 'Fired when a text search is completed';
reason?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'Indicates which extension or UI feature triggered this search' };
workspaceFolderCount: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The number of folders in the workspace' };
endToEndTime: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The total search time' };
scheme: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'The uri scheme of the folder searched in' };
error?: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'The type of the error, if any' };
};
type TextSearchCompleteEvent = {
reason?: string;
workspaceFolderCount: number;
endToEndTime: number;
scheme: string;
error?: string;
usePCRE2: boolean;
};
this.telemetryService.publicLog2<TextSearchCompleteEvent, TextSearchCompleteClassification>('textSearchComplete', {
reason: query._reason,
workspaceFolderCount: query.folderQueries.length,
endToEndTime: endToEndTime,
scheme,
error: errorType,
usePCRE2: !!query.usePCRE2
});
}
}
Expand Down